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(sqla): add time grain and time column to jinja params #16680

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

villebro
Copy link
Member

SUMMARY

Add time_grain and time_column variables to the default Jinja context. Also add default Jinja variables to the documentation.

With the following virtual dataset:

image

The generated query looks as follows:
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #16680 (1de4d66) into master (51acada) will decrease coverage by 0.11%.
The diff coverage is 94.52%.

❗ Current head 1de4d66 differs from pull request most recent head 0214e97. Consider uploading reports for the commit 0214e97 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16680      +/-   ##
==========================================
- Coverage   76.91%   76.80%   -0.12%     
==========================================
  Files        1005     1005              
  Lines       54017    54049      +32     
  Branches     7337     7339       +2     
==========================================
- Hits        41549    41512      -37     
- Misses      12228    12297      +69     
  Partials      240      240              
Flag Coverage Δ
hive ?
mysql 81.65% <95.23%> (+0.02%) ⬆️
postgres 81.67% <95.31%> (-0.02%) ⬇️
presto 81.52% <95.31%> (+0.02%) ⬆️
python 81.98% <95.31%> (-0.23%) ⬇️
sqlite 81.28% <95.23%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
...src/dashboard/components/gridComponents/Column.jsx 87.87% <ø> (ø)
...nd/src/dashboard/components/gridComponents/Row.jsx 86.66% <ø> (ø)
...perset-frontend/src/dashboard/util/isValidChild.ts 85.71% <ø> (-0.96%) ⬇️
superset/connectors/sqla/models.py 89.46% <75.00%> (-0.24%) ⬇️
...ashboard/components/gridComponents/ChartHolder.jsx 69.81% <87.50%> (+0.50%) ⬆️
superset/views/core.py 76.63% <96.15%> (+0.38%) ⬆️
...nd/src/dashboard/containers/DashboardComponent.jsx 100.00% <100.00%> (ø)
superset/utils/sqllab_execution_context.py 92.37% <100.00%> (+0.55%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.80% <0.00%> (-16.87%) ⬇️
... and 2 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 51acada...0214e97. Read the comment docs.

@villebro villebro added the doc:user User / Superset documentation label Sep 13, 2021
@villebro villebro requested a review from srinify September 13, 2021 13:28
template_kwargs = {
"from_dttm": from_dttm.isoformat() if from_dttm else None,
"groupby": groupby,
"metrics": metrics,
"row_limit": row_limit,
"row_offset": row_offset,
"time_column": granularity,
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM.

@villebro villebro merged commit 83581b1 into apache:master Sep 13, 2021
@villebro villebro deleted the villebro/time-jinja branch September 13, 2021 13:43
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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 doc:user User / Superset documentation preset-io size/M 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants