GitHub user dosubot[bot] added a comment to the discussion: Jinja Template - url_param not working
<!-- Answer --> The error is likely because your SQL references `sq2.survey_id`, but Superset datasets require you to use the plain column name as defined in the dataset—usually just `survey_id` (not qualified or aliased) [source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/connectors/sqla/models.py). Also, your SDK config uses `urlParams: { id: 8 }`, but your Jinja macro expects `survey_id`. Both names must match for the parameter to be picked up [source](https://github.com/apache/superset-embedded-sdk/src/index.ts). Try updating your query to: ```sql survey_id IN ({{ url_param('survey_id') | default(8) | int }}) ``` and your SDK config to: ```js urlParams: { survey_id: 8 } ``` If you use `filter_values`, the same column name rule applies. If you still see missing columns, use an `if/else` in your SQL to ensure the query always returns results, like: ```sql WHERE 1=1 {% if url_param('survey_id') %} AND survey_id = {{ url_param('survey_id') | int }} {% else %} AND survey_id = 8 {% endif %} ``` This prevents empty result sets from causing column sync issues [source](https://github.com/apache/superset/issues/33591). If problems persist, check your dataset definition in Superset to confirm `survey_id` is present, and review logs for more details. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/158f9f97-00fc-439a-8fff-eb84d2d11389?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35480) GitHub link: https://github.com/apache/superset/discussions/35480#discussioncomment-14614835 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
