Jinja Template - url_param not working #35480
Replies: 3 comments 1 reply
-
|
Hi @j7282978-ops! I'm Dosu and I’m helping the superset team. The most common reason Make sure your embedding setup propagates embedDashboard({
id: DASHBOARD_ID,
supersetDomain: "http://localhost:8088",
mountPoint: document.getElementById("dashboard-container"),
dashboardUiConfig: {
urlParams: { survey_id: 6 },
// other config...
}
});If you’re still seeing the default value, check for CORS/session issues, RBAC permissions for the embedded user, and confirm that the backend receives the expected For dynamic filtering, you can also use the SELECT *
FROM table
WHERE id IN {{ filter_values('survey_id') | where_in }}This approach is often more robust for dashboard filters source. If you need a working example, the SDK and backend should pass To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
@dosu This is the query This shows an error in the chart - "Error: Columns missing in dataset: " Getting same error with filter_values. |
Beta Was this translation helpful? Give feedback.
-
|
My bad. Survey_id is correctly used at both places still getting the error. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I’m trying to embed a Superset dashboard in a React app using the Superset SDK. I want to pass a parameter called survey_id via URL parameters and use it in my dataset query:
SELECT *
FROM table
WHERE id IN ({{ url_param('survey_id') | default(3) | int }})
However, the query always defaults to 3 and doesn’t filter based on the value I’m sending.
I’ve enabled the relevant feature flags in superset_config.py:
FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING": True,
"ALERT_REPORTS": True,
"EMBEDDED_SUPERSET": True
}
Here’s how I’m embedding the dashboard in React using embedDashboard:
const dashboardUiConfig = {
urlParams: {
survey_id: 6, // parameter to pass to Superset
...(permalinkKey ? { permalink_key: permalinkKey } : {}) // optional
},
filters: { expanded: false, visible: false }, // control filter visibility
hideTitle: true,
hideChartControls: true,
hideTab: true
};
// Example usage
embedDashboard({
id: DASHBOARD_ID,
supersetDomain: "http://localhost:8088",
mountPoint: document.getElementById("dashboard-container"),
dashboardUiConfig
});
Questions:
I want survey_id to be picked up by the dashboard query, but it always defaults to the default(3) value.
Is there anything else I need to configure to make url_param work in this embedded setup?
Any guidance or working examples would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions