Skip to content

Feat(snowflake): add autoincrement order clause support#5223

Merged
georgesittas merged 7 commits intotobymao:mainfrom
dmaresma:main
Jun 16, 2025
Merged

Feat(snowflake): add autoincrement order clause support#5223
georgesittas merged 7 commits intotobymao:mainfrom
dmaresma:main

Conversation

@dmaresma
Copy link
Contributor

Hi, this PR solve the

import sqlglot
sql = ("""CREATE TABLE IF NOT EXISTS  PUBLIC.my_table (
  -- https://docs.snowflake.com/en/sql-reference/intro-summary-data-types
  field_primary_key      NUMBER(38,0) NOT NULL autoincrement start 1 increment 1 order COMMENT 'Primary key') COMMENT = 'myComment'""", "snowflake") 

dialect = sql[1]
try:
        parsed = sqlglot.parse_one(sql=sql[0], read=dialect.lower())
        tables = parsed.find_all(sqlglot.expressions.Table)
except Exception as e:
        print("sqlglot_failure on",sql[1], e)

return :

sqlglot_failure on snowflake Expecting ). Line 3, Col: 86.
  summary-data-types
  field_primary_key      NUMBER(38,0) NOT NULL autoincrement start 1 increment 1 order COMMENT 'Primary key') COMMENT = 'myComment'

@georgesittas
Copy link
Collaborator

Hey, thanks for the PR, we'll take a look soon. You can run make style to ensure the linter & formater are satisfied.

Comment on lines +5915 to +5916
show_order = None
order = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look right, we should only introduce order and then treat None as "does not exist" / "don't show".

@georgesittas georgesittas changed the title add snowflake autoincrement start _ increment _ [noorder | order] support Feat(snowflake): add autoincrement order clause support Jun 14, 2025
@georgesittas
Copy link
Collaborator

I'll get this in and take it to the finish line. Thanks!

@georgesittas georgesittas merged commit c1cb9f8 into tobymao:main Jun 16, 2025
7 checks passed
@georgesittas
Copy link
Collaborator

See here: 7d966e6

@dmaresma
Copy link
Contributor Author

Thank you very much, really appreciate

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.

3 participants