redash
redash copied to clipboard
Query results query parameters
What type of PR is this?
- [ ] Refactor
- [ X ] Feature
- [ ] Bug Fix
- [ ] New Query Runner (Data Source)
- [ ] New Alert Destination
- [ ] Other
Description
Modified the Query Results query runner to allow for the passing of query parameters. Should be 100% backward compatible.
The Query Results query runner can now pass query parameters using the following format:
param_query_<query_id>_{<URL ENCODED KEY=VALUE PARAMETER STRING>}
The format above should hopefully be intuitive for users as it uses a prefix to denote the query type, much like the "cached" prefix denotes caches queries.
The temporary tables created for each parameterized query will be unique baed on the hashed value of the query id + parameters, so it is possible to reuse the same query more than once and select for different results based on the values supplied.
Example:
Query 1:

Query 2:

Query 3 (example calling parameterized, cached, and non-parameterized queries):

How is this tested?
- [ X ] Unit tests (pytest, jest)
- [ ] E2E Tests (Cypress)
- [ ] Manually
- [ ] N/A
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
This would be an excellent addition to the existing QRDS support and help to avoid having to do too much filtering in memory :pray:
This feature is awesome! I hope this pull request would be merged as soon as possible.
Agreed this is an awesome feature addition. Hope this PR gets some attention soon!
@ehearty , thanks for the PR! We've updated a lot of things now that we're Community-driven so - if you're still interested in getting this merged - would you mind rebasing off master to re-run the CI, as well as updating merge conflicts?
We're trying to clean up our PR todo list, so if you're not interested, that's fine - we'll close the PR in about a week if we don't hear back. If you're interested in reopening the PR afterwards, we would also very much welcome that.
Codecov Report
Merging #5723 (0fc72b2) into master (1ef63fc) will increase coverage by
0.03%. Report is 1 commits behind head on master. The diff coverage is64.51%.
@@ Coverage Diff @@
## master #5723 +/- ##
==========================================
+ Coverage 60.74% 60.77% +0.03%
==========================================
Files 154 154
Lines 12628 12656 +28
Branches 1716 1721 +5
==========================================
+ Hits 7671 7692 +21
- Misses 4732 4739 +7
Partials 225 225
| Files Changed | Coverage Δ | |
|---|---|---|
| redash/query_runner/query_results.py | 61.36% <64.51%> (+0.41%) |
:arrow_up: |
Cool, it's passed our CI tests.
@getredash/maintainers Anyone feel like reviewing this? It's Python only, and judging by the feedback icons on the request it seems like a few people are wanting it. :smile: