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

Teradata: Added date as bare function #1663

Merged
merged 3 commits into from
Oct 15, 2021
Merged

Teradata: Added date as bare function #1663

merged 3 commits into from
Oct 15, 2021

Conversation

anzelpwj
Copy link
Contributor

Brief summary of the change made

Fixes #1611 . I've added DATE as a bare function (line 89).

Are there any other side effects of this change that we should be aware of?

I also removed it from unreserved and reserved keywords - please let me know if this an incorrect change and I can adjust as necessary.

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with python test/generate_parse_fixture_yml.py or by running tox locally).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

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.

change looks good. But some requests for the test cases if you could have a look?

@@ -0,0 +1 @@
SELECT DATE;
Copy link
Member

Choose a reason for hiding this comment

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

Nit, but could you add a new line to the end of the file? We have an editorconfig file if your editor supports that (most of them do) to enforce that without you having too.

Also are there any other examples we could use here? Can DATE be used with any params? If so could you add another example or two? Remember to regenerate the YAML after.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SELECT DATE (FORMAT 'MMMbdd,bYYYY') (CHAR(12), UC); from the docs doesn't parse.

Copy link
Member

Choose a reason for hiding this comment

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

What about:

SELECT DATE (FORMAT 'MMMbdd,bYYYY') 

for now? Could do the next (casting?) bit at another time. Unless you wanna figure out how to do that now to as part of this PR?

Copy link
Contributor Author

@anzelpwj anzelpwj Oct 15, 2021

Choose a reason for hiding this comment

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

Specifically, it doesn't like the (CHAR(12), UC) bit - this might be something to address in a different MR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Oct 15, 2021

Codecov Report

Merging #1663 (7c937e5) into main (ec7c2dd) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1663   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          133       133           
  Lines         9316      9317    +1     
=========================================
+ Hits          9316      9317    +1     
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_teradata.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 ec7c2dd...7c937e5. Read the comment docs.

@tunetheweb
Copy link
Member

Thanks for those other test case. They aren’t parsing as bare_functions but that’s fine (they aren’t bare functions!), but think good to have none the less.

If tests pass we can approve and merge.

@anzelpwj
Copy link
Contributor Author

Do I need to update changelog, contributors, etc?

@tunetheweb
Copy link
Member

Nope. All automatic. See #1287 and #1295

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.

First PR to the project. Woo hoo and thanks!!

@tunetheweb tunetheweb merged commit b186b53 into sqlfluff:main Oct 15, 2021
@anzelpwj
Copy link
Contributor Author

Hooray! Thanks for the help!

@anzelpwj anzelpwj deleted the teradata_date branch October 15, 2021 21:00
@tunetheweb tunetheweb changed the title Added date as bare function for teradata Teradata: Added date as bare function Oct 20, 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.

Teradata parsing unable to handle DATE command
2 participants