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

Snowflake: Support CURRENT_TIMESTAMP as a column default value #1578

Merged
merged 5 commits into from Oct 11, 2021

Conversation

wong-codaio
Copy link
Contributor

@wong-codaio wong-codaio commented Oct 9, 2021

Brief summary of the change made

  • Support CURRENT_TIMESTAMP as a column default value in Snowflake dialect.

Fixes #1576

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

Not that I'm aware of.

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:

    • .sql/.yml parser test cases in test/fixtures/parser (note YML files can be auto generated with python test/generate_parse_fixture_yml.py or by running tox locally).

@codecov
Copy link

codecov bot commented Oct 9, 2021

Codecov Report

Merging #1578 (55637de) into main (15bbf71) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1578   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          131       131           
  Lines         9172      9172           
=========================================
  Hits          9172      9172           
Impacted Files Coverage Δ
src/sqlfluff/dialects/dialect_snowflake.py 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 15bbf71...55637de. Read the comment docs.

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 great!

One comment to consider taking this to the next level.

src/sqlfluff/dialects/dialect_snowflake.py Outdated Show resolved Hide resolved
src/sqlfluff/dialects/dialect_snowflake.py Outdated Show resolved Hide resolved
@tunetheweb
Copy link
Member

tunetheweb commented Oct 10, 2021

Looks great. If you could just run black on that file to fix the linting errors and merge from main (which should fix those dbt errors) then think this is good to merge.

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.

Approved, with a small formatting change I'll commit.

The DBT errors are something we introduced so ignore them.

Thanks for the contribution! Will be included in next release.

src/sqlfluff/dialects/dialect_snowflake.py Outdated Show resolved Hide resolved
@tunetheweb tunetheweb merged commit a9a1893 into sqlfluff:main Oct 11, 2021
ttomasz pushed a commit to ttomasz/sqlfluff that referenced this pull request Oct 12, 2021
…uff#1578)

* Column default value: Support CURRENT_TIMESTAMP

Issue sqlfluff#1576

* * Generated `yml` fixture

* * Added `SYSDATE()` and `CURRENT_TIMESTAMP` optional precision support

* Update src/sqlfluff/dialects/dialect_snowflake.py

Co-authored-by: Barry Pollard <barry_pollard@hotmail.com>
Co-authored-by: Barry Pollard <barry@tunetheweb.com>
@wong-codaio wong-codaio deleted the wong-fix-current-timestamp branch December 21, 2021 18:37
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.

Snowflake/Create Table: Unable to parse TIMESTAMP_TZ column with CURRENT_TIMESTAMP as default.
2 participants