-
Notifications
You must be signed in to change notification settings - Fork 591
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: Generalizing CREATE SEQUENCE #3090
feat: Generalizing CREATE SEQUENCE #3090
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's try to refactor this by leveraging _parse_properties()
(see comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments @VaggelisD
Great idea, but is the idea "only" to allow parsing and generating within the same dialect? Because, if you also want to support transpiling, by looking at the code and the tests, I am not sure if Oracle's Side note: |
Hey Mike, thanks for the review / feedback 👋
For now, that's what we're aiming for. The goal is to allow fine-grained parsing of the Perhaps at some point in the future we could refactor this to control more easily which options / properties are generated per dialect to improve the transpilation. P.S. just double-checking, but is this related to transpilation, or did you also notice an issue for the Oracle -> Oracle case?
|
Aftert looking again, I guess I mean just transpiling. I was kinda confused when looking at cache = expression.args.get("cache")
if cache is None:
cache_str = ""
elif cache is True:
cache_str = " CACHE"
else:
cache_str = f" CACHE {cache}" and not seeing So Which also means that if you construct something like |
That's correct, these options are generated using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few final cleanup suggestions, nice work @VaggelisD.
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Fixes #3072
Generalize
CREATE SEQUENCE
among Oracle, T-SQL, Postgres, DuckDB, Snowflake.Design Notes:
UnloggedProperty
that exists in Postgres for tables and sequencesCREATE SEQUENCE
order agnostic as dialects had differences between themOPTIONS
dictionary to simplify parsingexp.GeneratedAsIdentityColumnConstraint
, maybe a refactor between them is favorable?GlobalProperty
(post-create properly) andSharingProperty
(Oracle post-name) to accommodate for regressions on a command identity , which enabled it's full roundtrip.Docs