-
Notifications
You must be signed in to change notification settings - Fork 14k
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(mssql): support cte in virtual tables #18567
Conversation
…rrespetcive of dbengine
…rrespetcive of dbengine
…nto mssql_cte_fix
Unit test added for the db engine CTE SQL parsing. Removed additional spaces from the CTE parsing SQL generation.
Codecov Report
@@ Coverage Diff @@
## master #18567 +/- ##
=======================================
Coverage 66.32% 66.33%
=======================================
Files 1592 1592
Lines 62569 62596 +27
Branches 6295 6295
=======================================
+ Hits 41501 41525 +24
- Misses 19416 19419 +3
Partials 1652 1652
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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, thanks for working on this, a huge improvement to support CTEs on databases that don't support nested CTEs!
Thank you @villebro for all the help you provided . |
SUMMARY
Superset was not allowing to run CTE based SQLs on MSSQL while creating virtual tables, because MSSQL is not supporting CTE in subquery. Always the CTE sql should be at the top. Hence added the fix to make the SQL to run as same as CTE, this feature can be used for all the databases. Added a new flag called "allows_cte_in_subquery" , if it's True, Superset will parse CTE as Subquery and run it else Superset will run the CTE as same as it is.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Added unit test case, unit test case can be run against mssql dbengine using below command
tox -e sqlite tests/unit_tests/db_engine_specs/test_mssql.py