SanthoshLakshmi opened a new issue, #37609: URL: https://github.com/apache/superset/issues/37609
### Bug description **Environment** - Product: Apache Superset - Deployment: Docker / Local (as applicable) - Database: PostgreSQL / ClickHouse (observed across databases) - Dataset type: SQL (Virtual Dataset) **Description** When a SQL dataset query in Apache Superset returns zero rows, the dataset’s column metadata is not persisted. Although the query executes successfully, Superset does not retain column names and data types, resulting in an empty or incomplete dataset schema. This behavior affects use cases where an empty result set is valid and expected, such as time-based filters, conditional queries, or operational reporting. **Steps to Reproduce** 1. Create a SQL dataset using the following query: ``` SELECT column_, column_2, column_3 FROM table_name WHERE date_column = '2026-02-01'; ``` 2. Save the dataset 3. Refresh the dataset metadata 4. Observe that the dataset columns are not stored **Expected Behavior** 1. Column metadata should be persisted even when the query returns zero rows 2. Column names and data types should be inferred from the SQL query or cursor description 3. The dataset should remain usable in Explore, charts, filters, and alerts **Actual Behavior** - Query executes successfully - Result set contains zero rows - Column metadata is not persisted - Dataset schema appears empty, causing charts and filters to fail **Impact** - Dashboards may break when data is temporarily unavailable - Alerts and reports cannot reliably handle no-data scenarios - Users must rely on SQL workarounds to force metadata detection **Suggested Improvement** Persist dataset column metadata based on the SQLAlchemy cursor description, even when the query returns an empty result set. <img width="735" height="771" alt="Image" src="https://github.com/user-attachments/assets/4f08ef89-6c6f-4fc9-9e31-811518b04899" /> <img width="603" height="405" alt="Image" src="https://github.com/user-attachments/assets/b3565f91-2442-49c9-b9a0-3e907e17062f" /> ### Screenshots/recordings _No response_ ### Superset version 6.0.0 ### Python version 3.9 ### Node version 16 ### Browser Chrome ### Additional context _No response_ ### Checklist - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem. - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report. - [ ] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
