Bug description
Bug Description
I am facing multiple issues in Apache Superset (running via Docker Compose):
- When I try to fetch table metadata in SQL Lab, the UI shows:
An error occurred while fetching table metadata. Please contact your administrator.
- The backend logs show:
POST /tableschemaview/ HTTP/1.1" 400 -
superset.exceptions.SupersetParseError: Error parsing near '`' at line 1:24
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 24.
- Additionally, I see 404 errors for
/ws
endpoint in the logs:
GET /ws HTTP/1.1" 404 -
Steps to Reproduce
- Start Superset using the official docker-compose setup.
- Go to SQL Lab and open a table (example:
examples.main.bart_lines
). - Check the network requests and logs — table metadata fails to load.
Expected Behavior
- Table metadata should load successfully in SQL Lab.
- No 404 errors for required endpoints.
- SQL parsing should not fail for valid queries.
Actual Behavior
- Metadata fetch returns
400
in/tableschemaview/
. - SQL parsing throws:
SupersetParseError: Error parsing near '`' at line 1:24
sqlglot.errors.ParseError: Invalid expression / Unexpected token
/ws
endpoint returns404
.
Environment
- Deployment: Docker Compose (from official repo)
- Database backend: PostgreSQL 16
- Feature flags:
SqllabBackendPersistence
is enabled
Additional Context
From the logs:
superset.exceptions.SupersetParseError: Error parsing near '`' at line 1:24
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 24.
GET /ws HTTP/1.1" 404 -
superset_app | 2025-09-03 08:05:40,411:INFO:werkzeug:172.18.0.1 - - [03/Sep/2025 08:05:40] "GET /ws HTTP/1.1" 404 -
superset_db | 2025-09-03 08:05:41.140 UTC [69] LOG: checkpoint starting: time
superset_db | 2025-09-03 08:05:41.734 UTC [85] ERROR: insert or update on table "tab_state" violates foreign key constraint "saved_query_id"
superset_db | 2025-09-03 08:05:41.734 UTC [85] DETAIL: Key (saved_query_id)=(1) is not present in table "saved_query".
superset_db | 2025-09-03 08:05:41.734 UTC [85] STATEMENT: INSERT INTO tab_state (created_on, changed_on, extra_json, user_id, label, active, database_id, schema, catalog, sql, query_limit, latest_query_id, autorun, template_params, hide_left_bar, saved_query_id, created_by_fk, changed_by_fk) VALUES ('2025-09-03T08:05:41.734100'::timestamp, '2025-09-03T08:05:41.734108'::timestamp, '{}', 1, 'Untitled Query 1', true, 1, 'examples.main', NULL, 'SELECT * from bart_lines
superset_app | 2025-09-03 08:05:41,738:INFO:werkzeug:172.18.0.1 - - [03/Sep/2025 08:05:41] "POST /tabstateview/ HTTP/1.1" 400 -
superset_db | ', NULL, NULL, false, NULL, false, 1, 1, 1) RETURNING tab_state.id
superset_db | 2025-09-03 08:05:43.334 UTC [69] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.126 s, sync=0.033 s, total=2.195 s; sync files=16, longest=0.032 s, average=0.003 s; distance=15 kB, estimate=4428 kB; lsn=0/2634880, redo lsn=0/2633E88
superset_db | 2025-09-03 08:05:46.793 UTC [85] ERROR: insert or update on table "tab_state" violates foreign key constraint "saved_query_id"
superset_db | 2025-09-03 08:05:46.793 UTC [85] DETAIL: Key (saved_query_id)=(1) is not present in table "saved_query".
superset_db | 2025-09-03 08:05:46.793 UTC [85] STATEMENT: INSERT INTO tab_state (created_on, changed_on, extra_json, user_id, label, active, database_id, schema, catalog, sql, query_limit, latest_query_id, autorun, template_params, hide_left_bar, saved_query_id, created_by_fk, changed_by_fk) VALUES ('2025-09-03T08:05:46.792670'::timestamp, '2025-09-03T08:05:46.792679'::timestamp, '{}', 1, 'Untitled Query 1', true, 1, 'examples.main', NULL, 'SELECT * from bart_lines
superset_app | 2025-09-03 08:05:46,796:INFO:werkzeug:172.18.0.1 - - [03/Sep/2025 08:05:46] "POST /tabstateview/ HTTP/1.1" 400 -
superset_db | ', NULL, NULL, false, NULL, false, 1, 1, 1) RETURNING tab_state.id
Also, I noticed that the request payload to /tableschemaview/
includes a tab_state_id
like MJdg7eUhcIl
, which doesn’t match the DB schema (tab_state_id
column is INTEGER by default). Postgres logs show:
ERROR: invalid input syntax for type integer: "MJdg7eUhcIl"
STATEMENT: DELETE FROM table_schema WHERE table_schema.tab_state_id = 'MJdg7eUhcIl' ...
This suggests a mismatch between frontend IDs (string) and backend DB schema (integer).
Questions
- Is the
/ws
404 expected? Should the WebSocket container handle this? - Why is
tab_state_id
being sent as a string (likeMJdg7eUhcIl
) when the DB column type is integer? - What is the correct fix for
SupersetParseError
when fetching table schema?
✅ Logs and tracebacks are included above. Please advise if there is an official migration, config change, or known bug related to this.
Screenshots/recordings
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.