Bug description
Queries which contain Jinja templating {{ dataset(id) }}
are saved successfully and are shown in the saved queries list. But after deleting one of the used dataset as a result we see no saved queries in the list and error An error occurred while fetching Saved queriess: Dataset ID not found
.
Therefore users can't delete the saved query with the deleted dataset to display the list of other saved queries.
How to reproduce the bug
- Add a dataset
- Create a saved query which contain a SQL statement with Jinja templating {{ dataset(id) }} (the ID of the dataset created in step 1), i.e.
SELECT * FROM {{ dataset(id) }}
- Go to
/savedqueryview/list/
to make sure that the query is listed - Delete the dataset created in step 1
-
Go to
/superset/welcome/
to see the errorThere was an issue fetching your saved queries: [object Response]
-
Go to
/savedqueryview/list/
to see the errorAn error occurred while fetching Saved queriess: Dataset ID not found!
and the empty list of saved queries
Screenshots/recordings
No response
Superset version
4.1.1
Python version
3.9
Node version
I don't know
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.
- [ ] 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]
Hey @vickr397! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's squash those bugs together! 🤖
The issue you're encountering seems to be related to how Superset handles saved queries that reference datasets, particularly when a dataset is deleted. When a dataset referenced in a saved query is not found, Superset uses the DatasetNotFoundErrorMessage
component to display an error alert with the message "Missing dataset" [1]. However, it seems that this error is preventing the display of other saved queries.
The error handling mechanism in the frontend uses the createErrorHandler
utility function to manage API errors related to fetching saved queries. This function is used to display error messages when issues occur, such as when a dataset is deleted and the saved query cannot be resolved [2][3].
To address this issue, you might consider checking if there are any updates or patches available for Superset that address this specific problem. Additionally, reviewing the error handling logic in the SavedQueryList
component might provide insights into how to modify the behavior to allow other saved queries to be displayed even when one references a deleted dataset.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Comment From: rusackas
Agreed, they should be listed, even if the queries WILL fail.
Comment From: rusackas
Can you provide any more explicit errors from the logs?
Comment From: vickr397
@rusackas, thanks for your answer.
Аfter going to /superset/welcome/
:
Аfter going to /savedqueryview/list/
:
We don't have any relevant events in the logs.