You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "yanlizhi (via GitHub)" <gi...@apache.org> on 2025/06/26 01:40:23 UTC

[I] psycopg2.errors.InvalidTextRepresentation [superset]

yanlizhi opened a new issue, #33914:
URL: https://github.com/apache/superset/issues/33914

   ### 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] psycopg2.errors.InvalidTextRepresentation [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #33914:
URL: https://github.com/apache/superset/issues/33914#issuecomment-4174759120

   Closing this issue due to inactivity. It was previously labeled 'requires:more-info' and no additional details were provided over several months.
   
   If you're still experiencing this PostgreSQL/Doris error, please open a new issue with a minimal reproduction case and full traceback.
   
   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] psycopg2.errors.InvalidTextRepresentation [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #33914:
URL: https://github.com/apache/superset/issues/33914#issuecomment-3006740080

   <!-- Greeting -->
   Hi @yanlizhi! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
   
   <!-- Answer -->
   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](https://github.com/apache/superset/blob/f802474b07bc7a2765e57fcd6612d2b4454f5c62/superset/models/core.py).
   
   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](https://github.com/apache/superset/issues/33659). 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.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/99b8ed5b-595a-42b2-a37e-d74fb13ee2ba?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33914)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] psycopg2.errors.InvalidTextRepresentation [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #33914: psycopg2.errors.InvalidTextRepresentation
URL: https://github.com/apache/superset/issues/33914


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org