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

feat!: Add ALTER TABLE SET #3485

Merged
merged 6 commits into from
May 18, 2024
Merged

feat!: Add ALTER TABLE SET #3485

merged 6 commits into from
May 18, 2024

Conversation

VaggelisD
Copy link
Collaborator

Introduce support for ALTER TABLE ... SET ... across first class dialects.

Design notes:

  • Create an exp.AlterSet node belonging in ALTER_PARSERS that will hold the arguments across all mentioned dialects
  • Create exp.DataDeletionProperty to parse T-SQL's DATA_DELETION argument
  • Modify exp.WithSystemVersioningProperty and exp.SerdeProperties to optionally include the WITH keyword as a boolean arg
  • Utilize parse_properties as a catch-all since many options are parsed as such already & to parse simple statements like ALTER TABLE ... SET <opt> = <val> as "anonymous" exp.Property which solves the need of more manual parsing

Docs

T-SQL | Postgres | Spark | Hive | Databricks | Snowflake | Redshift | BigQuery

Copy link
Collaborator

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

Great work @VaggelisD 👍

tests/dialects/test_tsql.py Show resolved Hide resolved
tests/dialects/test_snowflake.py Outdated Show resolved Hide resolved
sqlglot/generator.py Outdated Show resolved Hide resolved
sqlglot/dialects/hive.py Outdated Show resolved Hide resolved
sqlglot/dialects/postgres.py Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Show resolved Hide resolved
sqlglot/dialects/hive.py Outdated Show resolved Hide resolved
sqlglot/generator.py Outdated Show resolved Hide resolved
sqlglot/generator.py Outdated Show resolved Hide resolved
sqlglot/generator.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

Ok couple more comments, LGTM otherwise

sqlglot/dialects/athena.py Outdated Show resolved Hide resolved
sqlglot/generator.py Show resolved Hide resolved
@georgesittas georgesittas merged commit e281db8 into main May 18, 2024
6 checks passed
@georgesittas georgesittas deleted the vaggelisd/alter_set branch May 18, 2024 00: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.

None yet

2 participants