Skip to content

Snowflake: support for extended column options in CREATE TABLE - #1454

Merged
alamb merged 3 commits into
apache:mainfrom
validio-io:snowflake_create_table_column_extended
Oct 20, 2024
Merged

Snowflake: support for extended column options in CREATE TABLE#1454
alamb merged 3 commits into
apache:mainfrom
validio-io:snowflake_create_table_column_extended

Conversation

@7phs

@7phs 7phs commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

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
Comment thread src/ast/ddl.rs
Comment thread src/parser/mod.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/parser/mod.rs Outdated
Comment thread src/parser/mod.rs Outdated
Comment thread tests/sqlparser_snowflake.rs Outdated
Comment thread tests/sqlparser_snowflake.rs
@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
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs Outdated
Comment thread src/ast/ddl.rs
Comment thread src/ast/ddl.rs
Comment thread src/parser/mod.rs Outdated
@7phs
7phs requested a review from iffyio October 14, 2024 08:57

@iffyio iffyio left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread src/dialect/snowflake.rs Outdated
Comment thread src/parser/mod.rs Outdated
@7phs
7phs requested a review from iffyio October 17, 2024 19:10

@iffyio iffyio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! cc @alamb

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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