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: Fix CASTing variables #1627

Merged
merged 9 commits into from Oct 13, 2021
Merged

TSQL: Fix CASTing variables #1627

merged 9 commits into from Oct 13, 2021

Conversation

jpers36
Copy link
Contributor

@jpers36 jpers36 commented Oct 13, 2021

The TSQL dialect is unable to parse CAST statements which include parameters/variables. This fix will allow it to happen.

TSQL:
Add ParameterNameSegment to SingleIdentifierGrammar
Add CAST as a separate special function for parsing
Add CAST as an unreserved keyword
Adjust DECLARE syntax to remove Delimited logic that assumes statements have been delimited
Add test case handling the issue
Adjust test case YAMLs using CAST to represent that CAST is a keyword

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #1627 (eca55c0) into main (05d172f) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1627   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          131       131           
  Lines         9207      9211    +4     
=========================================
+ Hits          9207      9211    +4     
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_tsql_keywords.py 100.00% <ø> (ø)
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 05d172f...eca55c0. Read the comment docs.

@jpers36 jpers36 marked this pull request as draft October 13, 2021 14:49
@jpers36 jpers36 marked this pull request as ready for review October 13, 2021 16:19
@tunetheweb tunetheweb merged commit cb0ee46 into sqlfluff:main Oct 13, 2021
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