-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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(sql): add jinja support to metrics and expressions #15247
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15247 +/- ##
==========================================
- Coverage 77.25% 77.03% -0.23%
==========================================
Files 971 971
Lines 50308 50322 +14
Branches 6140 6140
==========================================
- Hits 38867 38765 -102
- Misses 11237 11353 +116
Partials 204 204
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
column_name = metric["column"].get("column_name") | ||
column_name = cast(str, metric["column"].get("column_name")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast is necessary, as it's not possible to do proper union types where column_name
is always defined if expression_type == 'SIMPLE'
but None
if expression_type == 'SQL'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
* feat(sql): add jinja support to metrics and expressions * add test
* feat(sql): add jinja support to metrics and expressions * add test
* feat(sql): add jinja support to metrics and expressions * add test
SUMMARY
This adds support for Jinja templating to calculated columns and SQL metrics. The PR also adds
TypedDict
types for adhoc metrics to improve code quality and linting.BEFORE
Before Jinja was not processed in calculated columns nor SQL metrics
AFTER
Now Jinja in both calculated columns and SQL metrics are processed correctly:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION