How to use sql templating in dataset #32215
Replies: 1 comment 1 reply
-
Hi @smokeriu! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together! I found a similar unsolved discussion regarding Jinja templating in Superset datasets. You might find it helpful to check out the Jinja Template discussion [1]. To use SQL templating in datasets, ensure that Jinja templating is enabled by setting the FEATURE_FLAGS = {
'ENABLE_TEMPLATE_PROCESSING': True,
} This configuration allows you to use Jinja templating in queries within SQL Lab and Explore, enabling the embedding of Python code in virtual datasets and custom SQL in filter and metric controls [2]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
I use SQL lab to create a SQL query like:
And config the parameter:
It works fine in sql lab.
But when I try to save the query as a dataset. Superset cannot recognize the variable and instead treats it as regular SQL text. So I got a empty dataset with empty column:
![image](https://private-user-images.githubusercontent.com/50287418/411879549-0af69afd-80f5-4230-aad4-850f69afe789.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTQyNzUsIm5iZiI6MTczOTU5Mzk3NSwicGF0aCI6Ii81MDI4NzQxOC80MTE4Nzk1NDktMGFmNjlhZmQtODBmNS00MjMwLWFhZDQtODUwZjY5YWZlNzg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA0MzI1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlZDIxYjAzNDIxMDE1MjVhM2QzYWE1ZjlmODBmOWU4MGZjNWExYzNjNTkwMjQ1ZWM0OTVjZDViNDMyYmIyMDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cSv7CIso1lUiEg5HM8PQYofbhmSfFu8VoQpZgj40SUg)
superset version: 4.1.1
Beta Was this translation helpful? Give feedback.
All reactions