Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for filters in sqlLab #14765

Merged
merged 6 commits into from Jun 1, 2021

Conversation

cccs-jc
Copy link
Contributor

@cccs-jc cccs-jc commented May 22, 2021

SQL lab can execute queries containing jinja templates.
sql_lab_default_value
You can specify key/values that your jinja template can use. However it's not possible to add additional filters like the Explore or the Dashboard would do.
specify_filters_in_sql_lab
This pull request adds support for filters provided in the sql lab parameters
sql_lab_results

This is very convenient to test templates since it behaves like the Explore or Dashboard.

Maybe the implementation details are not 100%. But I'm hoping the concept and ability to do this in sql lab is welcomed.

@codecov
Copy link

codecov bot commented May 22, 2021

Codecov Report

Merging #14765 (ed38434) into master (590fe20) will decrease coverage by 0.14%.
The diff coverage is 45.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14765      +/-   ##
==========================================
- Coverage   77.52%   77.37%   -0.15%     
==========================================
  Files         960      963       +3     
  Lines       48819    49336     +517     
  Branches     6120     6230     +110     
==========================================
+ Hits        37847    38176     +329     
- Misses      10769    10961     +192     
+ Partials      203      199       -4     
Flag Coverage Δ
hive ?
javascript 72.44% <0.00%> (-0.03%) ⬇️
mysql 81.63% <66.66%> (+0.23%) ⬆️
postgres 81.65% <66.66%> (+0.23%) ⬆️
presto ?
python 81.73% <66.66%> (-0.22%) ⬇️
sqlite 81.27% <66.66%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...erset-frontend/src/SqlLab/components/ResultSet.tsx 67.42% <0.00%> (-0.02%) ⬇️
superset/views/utils.py 83.27% <66.66%> (-1.05%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
...tersConfigModal/FiltersConfigForm/DefaultValue.tsx 26.31% <0.00%> (-62.58%) ⬇️
superset/db_engine_specs/gsheets.py 73.33% <0.00%> (-26.67%) ⬇️
...tend/src/filters/components/Time/transformProps.ts 66.66% <0.00%> (-22.23%) ⬇️
superset/db_engine_specs/hive.py 70.32% <0.00%> (-17.08%) ⬇️
superset/db_engine_specs/__init__.py 54.23% <0.00%> (-11.68%) ⬇️
...d/src/dashboard/components/gridComponents/Tabs.jsx 76.31% <0.00%> (-11.06%) ⬇️
...nts/controls/DateFilterControl/DateFilterLabel.tsx 73.72% <0.00%> (-9.33%) ⬇️
... and 108 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 590fe20...ed38434. Read the comment docs.

@junlincc junlincc requested a review from villebro May 24, 2021 16:18
@cccs-jc cccs-jc force-pushed the support_filters_in_sqllab branch from 5631687 to e96e9e0 Compare May 25, 2021 11:36
@cccs-jc cccs-jc force-pushed the support_filters_in_sqllab branch from e96e9e0 to f1e757a Compare May 25, 2021 17:21
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts

superset/views/utils.py Outdated Show resolved Hide resolved
superset/views/utils.py Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/M and removed size/S labels May 30, 2021
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just needs to fix the underscore dangle lint error

@villebro villebro merged commit eef489c into apache:master Jun 1, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
@villebro villebro mentioned this pull request Mar 9, 2023
9 tasks
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants