-
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
fix(sqla): copy temporal range logic to helper #22405
fix(sqla): copy temporal range logic to helper #22405
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22405 +/- ##
==========================================
- Coverage 66.87% 66.86% -0.01%
==========================================
Files 1847 1847
Lines 70574 70578 +4
Branches 7748 7748
==========================================
- Hits 47195 47192 -3
- Misses 21378 21385 +7
Partials 2001 2001
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 |
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.
ExploreMixin
has made the already confusing superset.connectors
even more difficult to maintain. I agree with this PR change and hope the community can reduce the superset.connectors
complexity.
HI @villebro. Thanks for flagging this. Yes, @hughhhh will be working on removing the code duplication in the next few weeks. The original plan was to incorporate SIP68 work here and remove the sqlaTable and migrate the tables and columns over to the new SIP68 models and at the same time use the new mixin, but we decided not to allow charts to be created by tables and columns and the new dataset models and now we need to dig right into sqlaTable instead. But the plan moving forward is to use the exploreMixin and clean up the sqlaTable code during the process of moving the code over. |
Thanks @eschutho for the context. Please feel free to tag me in the cleanup PRs to help push this cleanup effort forward. |
SUMMARY
When exploring a query containing a temporal column I noticed that the query would fail unless persisted as a virtual dataset when the
GENERIC_CHART_AXES
feature flag is enabled. Digging around I noticed that theExploreMixin
class in thesuperset.models.helpers
module (introduced in #20281) duplicates essentially all logic from theSqlaTable
class in thesuperset.connectors.sqla.models
module. From a maintenance perspective this is highly problematic, as the SQLA connector model is by far one of the biggest pieces of tech debt in the backend with poor test coverage, while simultaneously being very fragile and frequently receiving minor tweaks/fixes. Duplicating this code without having tests in place to ensure that they're in sync makes it difficult for contributors to know that changes need to be applied in both modules.This is just a hotfix to make the
ExploreMixin
class from the helpers module work withGENERIC_CHART_AXES
. However, IMO we need to deduplicate this code ASAP, as they've already diverged quite a bit, with many fixes to the SQLA model not having made their way into the helpers module (#22280 is an example of such). I haven't reviewed the original PR, but a simple solution that comes to mind is removing the original logic and addingExploreMixin
toSqlaTable
, which ensures that the legacy model (which is still the main one in use) uses the exact same logic as the new models.AFTER
Now a query that hasn't been saved as a virtual dataset works with temporal filters:
BEFORE
Previously the same chart would fail.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION