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

TSQL: Allow DECLARE/SET statements to parse using ExpressionStatement #1649

Merged
merged 3 commits into from Oct 14, 2021

Conversation

jpers36
Copy link
Contributor

@jpers36 jpers36 commented Oct 14, 2021

TSQL DECLARE and SET statements can have full expressions as the value to be assigned, but the parsers for each did not cover all possibilities. I have simplified both of these by replacing the right side of the assignment statement with ExpressionStatement.

I'm not sure why this wasn't the situation already, so I may be missing something, but I found no test cases or documentation to explain the decision. I have update our test cases to cover a couple valid scenarios which were previously unparseable. Two additional test cases had their YAML updated slightly.

Copy link
Member

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me! Will merge assuming tests pass.

Playing a blinder on T-SQL support. Hope it feels like you're making progress here - cause I certainly think you are! 😀

@codecov
Copy link

codecov bot commented Oct 14, 2021

Codecov Report

Merging #1649 (44f3c6c) into main (52b85c5) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1649   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          133       133           
  Lines         9251      9250    -1     
=========================================
- Hits          9251      9250    -1     
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_tsql.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52b85c5...44f3c6c. Read the comment docs.

@tunetheweb tunetheweb merged commit 6e4f2fc into sqlfluff:main Oct 14, 2021
CyberShadow pushed a commit to CyberShadow/sqlfluff that referenced this pull request Oct 14, 2021
…sqlfluff#1649)

* Fix TSQL DECLARE and SET statements to fully parse expression assignments

* Fix TSQL DECLARE and SET statements to fully parse expression assignments

Co-authored-by: jpersons <jpersons@iuhealth.org>
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.

None yet

2 participants