frappe / insights

Open source analytics / business intelligence tool (BI)
https://frappe.io/insights
GNU Affero General Public License v3.0
390 stars 187 forks source link

Unable to select calculated field on Visual query #182

Closed ekomim closed 9 months ago

ekomim commented 9 months ago

I should be able to select the result of the calculated column so I can use it on the Y-axis or as a column on a table, but it is showing "Internal Server Error" image

Here is the traceback:

Traceback (most recent call last): File "apps/frappe/frappe/app.py", line 95, in application response = frappe.api.handle() File "apps/frappe/frappe/api.py", line 54, in handle return frappe.handler.handle() File "apps/frappe/frappe/handler.py", line 47, in handle data = execute_cmd(cmd) File "apps/frappe/frappe/handler.py", line 85, in execute_cmd return frappe.call(method, frappe.form_dict) File "apps/frappe/frappe/init.py", line 1622, in call return fn(*args, *newargs) File "apps/frappe/frappe/client.py", line 188, in set_value doc.save() File "apps/frappe/frappe/model/document.py", line 309, in save return self._save(args, kwargs) File "apps/frappe/frappe/model/document.py", line 343, in _save self.run_before_save_methods() File "apps/frappe/frappe/model/document.py", line 1056, in run_before_save_methods self.run_method("before_save") File "apps/frappe/frappe/model/document.py", line 919, in run_method out = Document.hook(fn)(self, *args, kwargs) File "apps/frappe/frappe/model/document.py", line 1281, in composer return composed(self, method, *args, *kwargs) File "apps/frappe/frappe/model/document.py", line 1263, in runner add_to_return_value(self, fn(self, args, kwargs)) File "apps/frappe/frappe/model/document.py", line 916, in fn return method_object(*args, kwargs) File "apps/insights/insights/insights/doctype/insightsquery/insightsquery.py", line 45, in before_save self.variant_controller.before_save() File "apps/insights/insights/insights/doctype/insights_query/insightsassistedquery.py", line 43, in before_save update_sql(self.doc) File "apps/insights/insights/insights/doctype/insights_query/utils.py", line 63, in updatesql sql = datasource.build_query(query) File "apps/insights/insights/insights/doctype/insights_data_source/insightsdatasource.py", line 144, in build_query return self.db.build_query(query) File "apps/insights/insights/insights/doctype/insights_datasource/sources/basedatabase.py", line 48, in build_query querystr = self.querybuilder.build(query, dialect=self.engine.dialect) File "apps/insights/insights/insights/querybuilders/sqlbuilder.py", line 527, in build return self.build_assisted_query() File "apps/insights/insights/insights/querybuilders/sqlbuilder.py", line 794, in build_assisted_query return self.compile(query) File "apps/insights/insights/insights/querybuilders/sqlbuilder.py", line 667, in compile compiled = query.compile(compile_args) File "env/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 308, in compile return self._compiler(dialect, kw) File "env/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 316, in _compiler return dialect.statement_compiler(dialect, self, kw) File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 1426, in init Compiled.init(self, dialect, statement, kwargs) File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 867, in init self.string = self.process(self.statement, compile_kwargs) File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 912, in process return obj._compiler_dispatch(self, kwargs) File "env/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch return meth(self, kw) # type: ignore # noqa: E501 File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 4670, in visit_select for c in [ File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 4671, in self._label_select_column( File "env/lib/python3.10/site-packages/sqlalchemy/sql/compiler.py", line 4350, in _label_select_column impl = column.type.dialect_impl(self.dialect) AttributeError: 'NoneType' object has no attribute 'dialect_impl'

nextchamp-saqib commented 9 months ago

Hey, can you post the calculated column expression/formula you wrote?

nextchamp-saqib commented 9 months ago

This version of the visual query has been removed after https://github.com/frappe/insights/pull/185 hence closing