Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Error While Selecting Table to Create Query in Workbook #356

Open
Kathir-1995 opened this issue Nov 14, 2024 · 3 comments
Open

Comments

@Kathir-1995
Copy link

I have my own EC2 instance running Frappe version 15.47.2 and Insights version 3.0.6. Yesterday, I created some queries, charts, and dashboards. However, today I am encountering a validation error when trying to open an existing dashboard, and I am unable to create new queries. Below is the error I faced on the following API,

API: api/method/insights.api.workbooks.fetch_query_results

Error:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 34, in build
self.query = self.perform_operation(operation)
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 44, in perform_operation
return self.apply_source(operation)
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 104, in apply_source
return self.get_table_or_query(source_args.table)
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 79, in get_table_or_query
_table = InsightsTablev3.get_ibis_table(
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_table_v3/insights_table_v3.py", line 60, in get_ibis_table
t = ds.get_ibis_table(table_name)
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/insights_data_source_v3.py", line 280, in get_ibis_table
remote_db = self._get_ibis_backend()
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/insights_data_source_v3.py", line 179, in _get_ibis_backend
print(f"Connected to {self.name} ({self.title})")
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 114, in application
response = frappe.api.handle(request)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/api/init.py", line 49, in handle
data = endpoint(**arguments)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
return frappe.handler.handle()
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 49, in handle
data = execute_cmd(cmd)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py", line 1781, in call
return fn(*args, **newargs)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "/home/ubuntu/frappe-bench/apps/insights/insights/decorators.py", line 18, in wrapper
return function(*args, **kwargs)
File "/home/ubuntu/frappe-bench/apps/insights/insights/decorators.py", line 167, in wrapper
return function(*args, **kwargs)
File "/home/ubuntu/frappe-bench/apps/insights/insights/api/workbooks.py", line 17, in fetch_query_results
ibis_query = IbisQueryBuilder().build(operations, use_live_connection)
File "/home/ubuntu/frappe-bench/apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 37, in build
frappe.throw(
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py", line 658, in throw
msgprint(
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py", line 623, in msgprint
_raise_exception()
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py", line 574, in _raise_exception
raise exc
frappe.exceptions.ValidationError: Invalid Source Operation at position 1: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/middlewares.py", line 16, in call
return super().call(environ, start_response)
File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py", line 250, in call
return self.app(environ, start_response)
File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py", line 250, in call
return self.app(environ, start_response)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 79, in application
app(environ, start_response),
File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py", line 190, in application
resp = f(*args[:-2] + (request,))
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 132, in application
response = handle_exception(e)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 334, in handle_exception
response = frappe.utils.response.report_error(http_status_code)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/response.py", line 48, in report_error
frappe.errprint(traceback)
File "/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py", line 506, in errprint
print(msg)
BrokenPipeError: [Errno 32] Broken pipe

Screenshot:

image

@Kathir-1995 Kathir-1995 changed the title Validation Error While selecting table to create query on workbook Validation Error While selecting table to create query in workbook Nov 14, 2024
@Kathir-1995 Kathir-1995 changed the title Validation Error While selecting table to create query in workbook Validation Error While Selecting Table to Create Query in Workbook Nov 14, 2024
@nextchamp-saqib
Copy link
Member

It could be a problem with your database connection. Can you check if the data source status is "active"?

@Kathir-1995
Copy link
Author

Kathir-1995 commented Nov 14, 2024

Data source status is Active only. I need another one clarification. Do i need to use main branch as version or shall i use version 3 branch?

@nextchamp-saqib
Copy link
Member

Use the version-3 branch. The main branch only gets fixes and no new features.

Regarding the error, can you try connecting another data source and check? Or there should be a default data source for the site database (the database where your site points to) Can you try creating a query on this data source and check if the error persists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants