-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
fix(sqla): use same template processor in all methods #22280
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22280 +/- ##
==========================================
- Coverage 66.74% 65.43% -1.31%
==========================================
Files 1841 1846 +5
Lines 70219 70290 +71
Branches 7671 7683 +12
==========================================
- Hits 46865 45994 -871
- Misses 21371 22304 +933
- Partials 1983 1992 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
329ecb6
to
c5e2f2d
Compare
SUMMARY
Some methods in the SQLA model weren't using the already instantiated template processor, making the following template kwargs unavailable to certain fields, namely calculated expressions and saved metrics:
superset/superset/connectors/sqla/models.py
Lines 1127 to 1139 in 3ffe782
This fixes the issue and adds tests for all relevant cases:
AFTER
Notice how the metric referencing the time grain is now rendered correctly:
BEFORE
Previously it didn't render, as the
time_grain
variable wasn't available to the saved metric:TESTING INSTRUCTIONS
ADDITIONAL INFORMATION