Comments (4)
To address the issue of parameters not being included when sharing a query link in Apache Superset, especially when using templating in SQL Lab, it's important to understand the mechanisms Superset provides for sharing queries. There are two main methods to share queries with parameters:
-
Sharing via KV Store: This method is available if the
ShareQueriesViaKvStore
feature flag is enabled. It allows sharing a query with parameters by generating a short URL. The query and its parameters (templateParams
) are stored in a key-value store, and the shared link references this stored query. -
Sharing Saved Queries: When a query is saved, it can be shared using a direct link that includes the
savedQueryId
parameter. For this method, ensure the query is saved with all necessary parameters in thetemplateParams
field. The shared link will allow recipients to access the query along with its parameters.
To ensure your parameters are included when sharing a query link:
- Verify that the
templateParams
field is correctly populated before saving or sharing the query. - If using the KV Store method, ensure the
ShareQueriesViaKvStore
feature flag is enabled. - Confirm that your Superset version supports these features. If not, updating to the latest version or consulting the Superset documentation may be necessary.
These steps should help in sharing query links that include all necessary parameters, facilitating recipients to view and interact with the shared queries as intended. For more detailed implementation, you can refer to the source code in the superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
and the relevant migrations in the Superset GitHub repository.
Details
Sources
- superset/migrations/versions/2022-10-03_17-34_deb4c9d4a4ef_parameters_in_saved_queries.py
- superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
- CHANGELOG/2.1.1.md
- CHANGELOG/3.0.0.md
- superset-frontend/src/SqlLab/components/SaveQuery/index.tsx
- CHANGELOG/2.1.0.md
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
To resolve the issue with template_params
not being included when sharing a query link in Apache Superset, follow these targeted steps:
-
Correctly Set Template Parameters: Ensure you're using the
TemplateParamsEditor
to input your template parameters as JSON. This ensures they're correctly set for Jinja templating in your SQL queries. -
Serialization and Retrieval: When saving or sharing a query, the
templateParams
must be serialized correctly and included in the URL. Upon opening a shared query link, Superset should deserialize these parameters and load them into the SQL Lab context. This process is crucial for the parameters to be recognized and used in the shared query. -
Database and Migration Check: Confirm that your Superset instance includes the migration adding a
template_parameters
column in thesaved_query
table. This column is essential for storing and retrieving template parameters in saved queries, ensuring they persist when sharing query links. -
Debugging and Testing: If the issue persists, debug by checking the URL generation to ensure
templateParams
are included, and verify that upon opening the link, parameters are correctly parsed and set into the application's state. Also, ensure your error handling logic is robust to catch and report any issues with template parameters.
By ensuring the correct setup and handling of template_params
, you can improve the reliability of sharing query links with parameters in Apache Superset.
Details
Sources
- superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx
- superset/migrations/versions/2022-10-03_17-34_deb4c9d4a4ef_parameters_in_saved_queries.py
- superset/sqllab/query_render.py
- superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
- superset-frontend/src/dashboard/util/extractUrlParams.ts
- superset-frontend/src/utils/urlUtils.ts
- superset-frontend/src/explore/exploreUtils/getParsedExploreURLParams.ts
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from superset.
i got this error when creating the link
There was an error with your request
and here is the network response
from superset.
For fruther information form the network
You can see the template_params returns with null while when i saved it i checked the network and i can see the template_params has value
from superset.
Related Issues (20)
- Getting forbidden toaster when a user without link share permission clicks on the link icon HOT 2
- Filter Visibility and User-Specific Data in Shared Dashboards HOT 4
- Changing languages doesn't affect echarts charts. HOT 5
- logger `superset` in production mode writing logs to stderr confuses logging service in Google Cloud HOT 3
- New tooltip in 4.1.0+ is inappropriately combines series on mixed chart with two y-axes
- How to Disable All Tooltips in an Entire Dashboard? HOT 3
- dashboard and chart cache refresh unexpected behaviour HOT 4
- Placeholders and "select all" option of select filters are missing localization HOT 4
- Maximum update depth exceeded HOT 2
- Got an 'Unexpected error' message when a build a deck.gl Scatterplot chart HOT 5
- flask_log.current_user set to None in SQL_QUERY_MUTATOR while using SQLLab HOT 3
- SQL_QUERY_MUTATOR not called in SQLab with MUTATE_AFTER_SPLIT = True HOT 1
- query history gets a long time to fetch data HOT 12
- superset init value error HOT 2
- docker bug HOT 2
- Add Support for SQL Server Analysis Services (SSAS) Connection with MDX Query Execution, Dimension Management, Pivot Tables, and Domain User Login HOT 3
- Environment variable SUPERSET_DATABASE_URI HOT 6
- Superset 4.1.0RC2 - Dashboard embedding - now includes editor and last modified timestamp HOT 2
- Docker build it failing - Docker compose up is not working HOT 3
- `show summary` does not correctly apply all filters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.