Bug description

[SQL: SELECT dbs.uuid AS dbs_uuid, dbs.created_on AS dbs_created_on, dbs.changed_on AS dbs_changed_on, dbs.id AS dbs_id, dbs.verbose_name AS dbs_verbose_name, dbs.database_name AS dbs_database_name, dbs.sqlalchemy_uri AS dbs_sqlalchemy_uri, dbs.password AS dbs_password, dbs.cache_timeout AS dbs_cache_timeout, dbs.select_as_create_table_as AS dbs_select_as_create_table_as, dbs.expose_in_sqllab AS dbs_expose_in_sqllab, dbs.configuration_method AS dbs_configuration_method, dbs.allow_run_async AS dbs_allow_run_async, dbs.allow_file_upload AS dbs_allow_file_upload, dbs.allow_ctas AS dbs_allow_ctas, dbs.allow_cvas AS dbs_allow_cvas, dbs.allow_dml AS dbs_allow_dml, dbs.force_ctas_schema AS dbs_force_ctas_schema, dbs.extra AS dbs_extra, dbs.encrypted_extra AS dbs_encrypted_extra, dbs.impersonate_user AS dbs_impersonate_user, dbs.server_cert AS dbs_server_cert, dbs.is_managed_externally AS dbs_is_managed_externally, dbs.external_url AS dbs_external_url, dbs.created_by_fk AS dbs_created_by_fk, dbs.changed_by_fk AS dbs_changed_by_fk FROM dbs WHERE dbs.id = %(pk_1)s] [parameters: {'pk_1': 'doris-Apache Doris-1'}] (Background on this error at: https://sqlalche.me/e/14/9h9h )

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/superset/views/error_handling.py", line 101, in wraps return f(self, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/views/base_api.py", line 487, in get_list_headless duration, response = time_function(super().get_list_headless, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/superset/utils/core.py", line 1372, in time_function response = func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/api/init.py", line 1628, in get_list_headless count, lst = self.datamodel.query( ^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 501, in query count = self.query_count(query, filters, select_columns) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 406, in query_count return self._apply_inner_all( ^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 388, in _apply_inner_all query = self.apply_filters(query, inner_filters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 225, in apply_filters return filters.apply_all(query) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/filters.py", line 302, in apply_all query = flt.apply(query, values) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/filters.py", line 229, in apply raise ApplyFilterException(exception=exc) flask_appbuilder.exceptions.ApplyFilterException: ApplyFilterException: DataError 172.20.0.1 - - [26/Jun/2025:01:09:49 +0000] "GET /api/v1/dataset/?q=(filters:!((col%3Adatabase,opr%3Arel_o_m%2Cvalue%3A%27doris-Apache+Doris-1%27)%2C(col%3Aschema%2Copr%3Aeq%2Cvalue%3Atest)%2C(col%3Asql%2Copr%3Adataset_is_null_or_empty%2Cvalue%3A!t))%2Cpage%3A0) HTTP/1.0" 500 44 "https://superset.star-saas.com.cn/dataset/add/ " "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" 2025-06-26 01:09:49,297:WARNING:root:Filter exception for SqlaTable.database with value doris-Apache Doris-1, will not apply 2025-06-26 01:09:49,298:ERROR:superset.views.error_handling:ApplyFilterException: DataError Traceback (most recent call last): File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context self.dialect.do_execute( File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "doris-Apache Doris-1" LINE 3: WHERE dbs.id = 'doris-Apache Doris-1'

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hi @yanlizhi! I'm Dosu and I’m helping the superset team.

The error happens because the backend expects an integer database ID for filtering, but it's receiving a string like "doris-Apache Doris-1" instead. In Superset, the dbs.id column is an integer primary key, so filtering with a string causes a type mismatch and the psycopg2 error you see reference.

To filter datasets by database, you should first query the /api/v1/database/ endpoint to get the integer ID for your database (using its name if needed), then use that ID in your dataset filter reference. Sending the database name or a composite string directly will cause this error.

Check if your frontend, API client, or any custom code is sending the database name instead of the integer ID when filtering datasets. If you recently updated Superset or customized dataset filtering, review those changes to ensure the correct value is being sent. If you’re using the API directly, always use the integer database ID in your filters.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X