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 for extended column options in CREATE TABLE #1454

Merged
merged 3 commits into from
Oct 20, 2024

Conversation

7phs
Copy link
Contributor

@7phs 7phs commented Oct 2, 2024

Snowflake supports several extended options for column definitions:

-- Column definition
    <col_name> <col_type>
      [ inlineConstraint ]
      [ NOT NULL ]
      [ COLLATE '<collation_specification>' ]
      [
        {
          DEFAULT <expr>
          | { AUTOINCREMENT | IDENTITY }
            [
              {
                ( <start_num> , <step_num> )
                | START <num> INCREMENT <num>
              }
            ]
            [ { ORDER | NOORDER } ]
        }
      ]
      [ [ WITH ] MASKING POLICY <policy_name> [ USING ( <col_name> , <cond_col1> , ... ) ] ]
      [ [ WITH ] PROJECTION POLICY <policy_name> ]
      [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]
      [ COMMENT '<string_literal>' ]

This merge request implements support for these additional column options.

@7phs 7phs force-pushed the snowflake_create_table_column_extended branch from 3b95e3b to ee816e2 Compare October 2, 2024 14:59
src/ast/ddl.rs Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
tests/sqlparser_snowflake.rs Outdated Show resolved Hide resolved
tests/sqlparser_snowflake.rs Show resolved Hide resolved
@7phs 7phs force-pushed the snowflake_create_table_column_extended branch from e5ac170 to 0c3849e Compare October 9, 2024 10:25
@7phs 7phs requested a review from iffyio October 9, 2024 11:32
@7phs 7phs force-pushed the snowflake_create_table_column_extended branch from c731c4b to 96ec5b1 Compare October 9, 2024 11:35
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Outdated Show resolved Hide resolved
src/ast/ddl.rs Show resolved Hide resolved
src/ast/ddl.rs Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
@7phs 7phs requested a review from iffyio October 14, 2024 08:57
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

@7phs just a couple comments and I think this looks good!

src/dialect/snowflake.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
@7phs 7phs requested a review from iffyio October 17, 2024 19:10
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! cc @alamb

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @7phs and @iffyio

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11391429828

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 279 of 284 (98.24%) changed or added relevant lines in 6 files are covered.
  • 1410 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+0.07%) to 89.392%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dialect/snowflake.rs 55 56 98.21%
src/parser/mod.rs 14 15 93.33%
tests/sqlparser_mssql.rs 11 12 91.67%
src/ast/ddl.rs 39 41 95.12%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_mssql.rs 1 93.38%
src/lib.rs 3 12.2%
src/tokenizer.rs 49 94.14%
src/ast/mod.rs 394 82.44%
src/parser/mod.rs 411 93.39%
tests/sqlparser_common.rs 552 89.58%
Totals Coverage Status
Change from base Build 11239696437: 0.07%
Covered Lines: 30428
Relevant Lines: 34039

💛 - Coveralls

@alamb alamb merged commit 3421e1e into apache:main Oct 20, 2024
10 checks passed
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.

4 participants