Skip to content

No saved queries are shown if there is a saved query with jinja {{ dataset(id) }} (after deleting the dataset) #32771

Open
@vickr397

Description

@vickr397

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

  1. Add a dataset

  2. 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) }}

  3. Go to /savedqueryview/list/ to make sure that the query is listed

  4. Delete the dataset created in step 1

  5. Go to /superset/welcome/ to see the error There was an issue fetching your saved queries: [object Response]
    Image

  6. Go to /savedqueryview/list/ to see the error An error occurred while fetching Saved queriess: Dataset ID not found! and the empty list of saved queries
    Image

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions