Skip to content

Allow IF NOT EXISTS after table name for Snowflake #1881

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

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

bombsimon
Copy link
Contributor

Although not documented under
https://docs.snowflake.com/en/sql-reference/sql/create-table, it is valid to put the IF NOT EXIST after the table name when creating a table for Snowflake.

This adds support to check for IF NOT EXIST again after parsing the table name if it wasn't found before the name.


I wish I could find some references of this, but sadly it's not that easy. Best I can do is to provide a screenshot from their UI executing a query with IF NOT EXIST after the table and show that it succeeds.

image

Although not documented under
https://docs.snowflake.com/en/sql-reference/sql/create-table, it is
valid to put the `IF NOT EXIST` _after_ the table name when creating a
table for Snowflake.

This adds support to check for `IF NOT EXIST` again after parsing the
table name if it wasn't found before the name.
@bombsimon
Copy link
Contributor Author

As seen by my second commit I just saw further down that this seems to be true for all Snowflake parameters so this basically just extends the existing loop that checks for parameters to include the IF NOT EXIST which can show up anywhere (even after the schema).

@bombsimon bombsimon requested a review from iffyio June 11, 2025 15:34
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! Thanks @bombsimon!
cc @alamb

@iffyio iffyio merged commit c2e83d4 into apache:main Jun 11, 2025
9 checks passed
@iffyio iffyio deleted the transient-table branch June 11, 2025 16:11
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.

2 participants