Skip to content
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 get_type with comments between WITH keyword #633

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Fix get_type with comments between WITH keyword #633

merged 1 commit into from
Jan 5, 2023

Conversation

shikanime
Copy link
Contributor

Fix #632

jkillian added a commit to hex-inc/sqlparse that referenced this pull request Jul 26, 2022
)

Fixes the issue reported in andialbrecht#632 with the fix proposed in andialbrecht#633. Thanks to @shikanime for making this fix, hopefully it will get merged upstream at some point, but for now we temporarily can use it in our own fork.
@mrmasterplan
Copy link
Collaborator

I like this change. This should be merged. You also added tests, thanks for that. Your test passes when I run it locally. Thanks for your contribution.

It seems that the tests did not run in the PR pipeline. I don't see why they didn't.
@andialbrecht, do you have any thoughts on this?

@shikanime
Copy link
Contributor Author

There is apparently a better solution by fixing the parser itself but so far I haven't found the main source of the problem.
It seems that the <Comment>.ttype is empty for some reason during the grouping process to IdentifierList (sqlparse/engine/filter_stack.py:36).
Therefore, the subsequent get_type() command has no appropriate AST to interpret, but for some statements such as Select are working for maybe some other reason downstream.

@andialbrecht
Copy link
Owner

It seems that the github actions were configured after this pr was created. Before github actions the tests ran on Travis CI. @shikanime maybe you can rebase your changes to the current sources. That should trigger the test pipeline.

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

Base: 96.95% // Head: 96.95% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (dd9d5b9) compared to base (907fb49).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #633   +/-   ##
=======================================
  Coverage   96.95%   96.95%           
=======================================
  Files          20       20           
  Lines        1544     1545    +1     
=======================================
+ Hits         1497     1498    +1     
  Misses         47       47           
Impacted Files Coverage Δ
sqlparse/sql.py 97.61% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mrmasterplan mrmasterplan merged commit 7fdb2da into andialbrecht:master Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Statement.get_type() does not skip comments between subqueries.
3 participants