-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: extract tables doesn't work with reserved keywords #17654
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17654 +/- ##
==========================================
+ Coverage 68.66% 68.85% +0.18%
==========================================
Files 1596 1597 +1
Lines 65224 65291 +67
Branches 6950 6950
==========================================
+ Hits 44789 44957 +168
+ Misses 18550 18449 -101
Partials 1885 1885
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
a30da26
to
da9f4b1
Compare
da9f4b1
to
bccf8b9
Compare
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.
Stellar work @betodealmeida ! LGTM
@betodealmeida it looks like this PR broke parsing table names from queries with sub selects. Here's a repro case: SELECT *
FROM
(SELECT 1 as foo, 2 as bar)
ORDER BY foo ASC, bar ParsedQuery now thinks that Do you think this is something you could easily fix, or should we consider reverting this PR? I could possibly look into fixing myself, but the sql parse codebase is something i'm a bit nervous about jumping into |
SUMMARY
I decided to convert some integration tests to unit tests. The low hanging fruit for this are the
sqlparse
tests, since they're self contained, so I decided to start there.As soon as I created my first test, I found a bug. I changed the SQL:
To:
And the test failed to identify
table_name
as a table in the query, since it's a reserved word insqlparse
.I fixed the problem, and converted all the integration tests.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
Added unit tests covering the problem.
ADDITIONAL INFORMATION