Skip to content

Dynamic SQL query #31722

Answered by dosubot bot
orazs asked this question in Q&A / Help
Jan 6, 2025 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Hey @orazs, I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

To achieve dynamic SQL query modification based on user input in Superset, you can use Jinja templating effectively. It seems like you're on the right track, but there might be a misunderstanding in how the filter_values function is used. Here's a refined approach:

  1. Ensure Jinja Templating is Enabled: Make sure that Jinja templating is enabled in your superset_config.py by setting the ENABLE_TEMPLATE_PROCESSING feature flag.

  2. Use filter_values Correctly: The filter_values function should be used to dynamically insert filter values into your query. Here's how you can modify your query:

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@orazs
Comment options

Answer selected by orazs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant