GitHub user stgztsw created a discussion: The SQL can be executed correctly, but fails to be saved as a dataset.
superset version 6.0.0rc1 In SQL Lab, i can execute the sql correctly,but fails to be saved as a dataset. I want to bind the SQL parameters to the dashboard filters, so I defined multiple SQL parameters. and ENABLE_TEMPLATE_PROCESSING has been set as true. SQL is like this: select * from udesk_cargo_management where 1=1 {% if filter_values('is_apply') is not none %} and is_apply in {{ filter_values('is_apply')|where_in }} {% endif %} {% if filter_values('core_attachment') is not none %} and core_attachment in {{ filter_values('core_attachment')|where_in }} {% endif %} {% if filter_values('english_name') is not none %} and english_name in {{ filter_values('english_name')|where_in }} {% endif %} {% if filter_values('attachment_name') is not none %} and attachment_name in {{ filter_values('attachment_name')|where_in }} {% endif %} {% if filter_values('attachment_number') is not none %} and attachment_number in {{ filter_values('attachment_number')|where_in }} {% endif %} Parameters definition: { "_filters": [ { "col": "is_apply", "op": "IN", "val": ["是"] }, { "col": "core_attachment", "op": "IN", "val": ["耗材","核心备件","易损件"] }, { "col": "english_name", "op": "IN", "val": ["test"] }, { "col": "attachment_name", "op": "IN", "val": ["中文名"] }, { "col": "attachment_number", "op": "IN", "val": ["1234567"] }, { "col": "mechine_version", "op": "IN", "val": ["V1.2.3"] }, { "col": "product_id", "op": "IN", "val": ["GS0001"] }, { "col": "robot_family_code", "op": "IN", "val": ["40","50","75","111","S","通用"] } ] } The sql executed correctly and the template has also been replaced normally. But when I saved sql as dataset, below error occured 2025-09-17 10:15:25,280:ERROR:flask_appbuilder.api:(1105, 'errCode = 2, detailMessage = Syntax error in line 170:\n AND is_apply IN ()\n ^\nEncountered: )\nExpected: IDENTIFIER\n') Traceback (most recent call last): File "/app/superset/connectors/sqla/utils.py", line 153, in get_columns_description cursor.execute(mutated_query) File "/app/.venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/app/.venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 265, in query _mysql.connection.query(self, query) MySQLdb.OperationalError: (1105, 'errCode = 2, detailMessage = Syntax error in line 170:\n AND is_apply IN ()\n ^\nEncountered: )\nExpected: IDENTIFIER\n') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/api/__init__.py", line 115, in wraps return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/views/base_api.py", line 120, in wraps duration, response = time_function(f, self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/utils/core.py", line 1409, in time_function response = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/utils/log.py", line 304, in wrapper value = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/superset/views/base_api.py", line 92, in wraps return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/datasets/api.py", line 360, in post new_model = CreateDatasetCommand(item).run() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/utils/decorators.py", line 267, in wrapped return on_error(ex) ^^^^^^^^^^^^ File "/app/superset/utils/decorators.py", line 232, in on_error raise ex File "/app/superset/utils/decorators.py", line 260, in wrapped result = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/commands/dataset/create.py", line 51, in run dataset.fetch_metadata() File "/app/superset/connectors/sqla/models.py", line 1646, in fetch_metadata new_columns = self.external_metadata() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/connectors/sqla/models.py", line 1287, in external_metadata return get_virtual_table_metadata(dataset=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/connectors/sqla/utils.py", line 131, in get_virtual_table_metadata return get_columns_description( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/connectors/sqla/utils.py", line 159, in get_columns_description raise SupersetGenericDBErrorException(message=str(ex)) from ex superset.exceptions.SupersetGenericDBErrorException: (1105, 'errCode = 2, detailMessage = Syntax error in line 170:\n AND is_apply IN ()\n ^\nEncountered: )\nExpected: IDENTIFIER\n') GitHub link: https://github.com/apache/superset/discussions/35171 ---- This is an automatically sent email for notifications@superset.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@superset.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org