Vitor-Avila commented on issue #25786: URL: https://github.com/apache/superset/issues/25786#issuecomment-1912063316
Hey @qleroy, As synced via Slack, during the dataset creation process the query is evaluated and doesn't have the parameters context defined in SQL Lab (@RubingHan did a much better job explaining this on the code level -- kudos!) resulting in a "broken" SQL query which throws the error. While you "could" create a dataset with this type of implementation before, you would end up with a "broken" dataset until the SQL parameters are defined in the new dataset (I don't think this was handled before), so you would still face an error, just one step further. You can avoid this error by adding if/else statements to your SQL query so that the query still works without the parameter values: ``` sql select * from {% if my_table %} {{my_table}} {% else %} foo {% endif %} ``` In regards to improving this flow, I think a good long-term solution would be adding a checkbox to the virtual dataset creation modal to ask users if the parameters defined in SQL Lab should be carried over to the virtual dataset, so they're used in the query validation + saved in the dataset level. -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org