superset icon indicating copy to clipboard operation
superset copied to clipboard

Non-descriptive error when saving Dataset from SQL Lab with JINJA placeholder present

Open maxgillmaxgill opened this issue 1 year ago • 3 comments

Bug description

I get a "FATAL ERROR" when I try to save a dataset from SQL Lab that looks like this:

SELECT COL_ID as ID, COL_DESCRIPTION as DESCRIPTION, COL_CREATEDDATE as CREATEDDATE, COL_TAG as TAG, COL_VIEWCOUNT as VIEWCOUNT FROM {{ecx_schema}}.tbl_kbtag

But I don't get an error if I save it like this: SELECT COL_ID as ID, COL_DESCRIPTION as DESCRIPTION, COL_CREATEDDATE as CREATEDDATE, COL_TAG as TAG, COL_VIEWCOUNT as VIEWCOUNT FROM my_schema.tbl_kbtag

While it would be good to be able to save these datasets and pre-populate the jinja params in the new dataset, simply explaining the error instead of "Fatal Error" would be a good start.

How to reproduce the bug

  1. Go to SQL Lab
  2. Create an SQL query with the schema name in a Jinja template
  3. Click Save Dataset

Screenshots/recordings

image

Superset version

3.0.3

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.

maxgillmaxgill avatar Jan 30 '24 00:01 maxgillmaxgill

relevant discussion #25786

qleroy avatar Jan 30 '24 03:01 qleroy

Adding a link the relevant PR that would likely close this (I think?)

https://github.com/apache/superset/pull/27796

rusackas avatar May 13 '24 18:05 rusackas

The issue appears when you try to use jinja templating and save the query in SQLLab as a dataset. If you save the dataset and provide a default value in place of using any jinja templates.Then during the chart development process, you can make updates to the query and enter your jinja template. This won't lead to errors.

amosanurag avatar Jun 20 '24 06:06 amosanurag

Closing as a duplicate of https://github.com/apache/superset/issues/25786... let's take the conversation (and hopefully a solution!) there.

rusackas avatar Aug 22 '24 18:08 rusackas