Hello.
I am trying to get the data export feature from Report Builder
to work.
I have created a filtered dataset within a DocType. However, when I choose Menu | Export I get the error:
Traceback (most recent call last):
File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
response = frappe.handler.handle()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
data = execute_cmd(cmd)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 64, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 1064, in call
return fn(*args, **newargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 536, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "/home/erpnext/frappe-bench/apps/frappe/frappe/desk/reportview.py", line 157, in export_query
filters=form_params.filters)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/access_log/access_log.py", line 35, in make_access_log
doc.insert(ignore_permissions=True)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 225, in insert
self.set_new_name()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 393, in set_new_name
set_new_name(self)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 42, in set_new_name
set_name_from_naming_options(autoname, doc)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 75, in set_name_from_naming_options
doc.name = _format_autoname(autoname, doc)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 298, in _format_autoname
name = re.sub(r"(\{[\w | #]+\})", get_param_value_for_match, autoname_value)
File "/home/erpnext/frappe-bench/env/lib/python3.6/re.py", line 191, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 295, in get_param_value_for_match
return parse_naming_series([trimmed_param], doc=doc)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 131, in parse_naming_series
part = getseries(n, digits)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/naming.py", line 159, in getseries
current = frappe.db.sql("SELECT `current` FROM `tabSeries` WHERE `name`=%s FOR UPDATE", (key,))
File "/home/erpnext/frappe-bench/apps/frappe/frappe/database/database.py", line 156, in sql
self._cursor.execute(query, values)
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/home/erpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1290, 'The MariaDB server is running with the --read-only option so it cannot execute this statement')
I can see from the common_site_config.json
on the ERPNext instance host that the value "read_from_replica": 1,
is set, and when I check the status from within the replica database using SHOW GLOBAL VARIABLES LIKE 'read_only';
that read-only mode is ON
So my assumption is that ERPNext is set to read from the read-replica db, but the data export feature is blocked because the read replica is readonly.
I note that in my non-production environment which does not have replication on, the data export works fine.
My question then is how to get data export working in the production environment where ERPNext is confirgured to read from the read replica?
Or if there is a way to work around this?
Thank you.