sqlglot icon indicating copy to clipboard operation
sqlglot copied to clipboard

Alter table does not handle `ADD PARTITION`

Open cosinequanon opened this issue 1 year ago • 4 comments

I would expect this syntax to do a roundtrip successfully:

>>> sqlglot.parse_one("ALTER TABLE foo ADD PARTITION(event='click')").sql()
"ALTER TABLE foo PARTITION(event = 'click')"

but it drops the ADD portion. This is valid syntax in spark (where I ran into it) so it at least needs to be added to that dialect.

cosinequanon avatar Jun 10 '25 16:06 cosinequanon

What is the input dialect?

georgesittas avatar Jun 10 '25 16:06 georgesittas

@georgesittas the code is a repro as is in a clean session.

but if you want a dialect then as I said in the comment, use spark

cosinequanon avatar Jun 10 '25 16:06 cosinequanon

Ah apologies, I missed it. Will take a look, thanks.

georgesittas avatar Jun 10 '25 16:06 georgesittas

@georgesittas thank you so much for fixing this!!! ❤

cosinequanon avatar Jun 13 '25 21:06 cosinequanon