-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add ability to set ORDER / NOORDER sequence on columns with IDENTITY #493
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Semi-related issue #494 |
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.
Hi,
Thank you for your contribution 💪
Pls provide test cases proving correctness of proposed solution.
Example test case could look like this
def test_table_create_order():
metadata= MetaData()
table = Table("test_table", m, Column("pk", Integer, Identity(start=1, increment=1, order=True)))
ddl_schema = schema.CreateTable(table)
res = _schema.compile(dialect=SnowflakeDialect())
expected = "..."
assert res.string == expected, res.string
…_identity unit test.
@sfc-gh-mraba thank you for the example, I added a unit test to tests/test_sequence.py (test_table_with_identity), let me know if the location is appropriate. |
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-889850: Add autoincrement support without (explicit) sequences #436
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
CREATE TABLE DDL supports optional
ORDER | NOORDER
value forAUTOINCREMENT | IDENTITY
sequences on a column. Before this change, using a column with a sequence likeColumn(NUMBER, Identity(start=1, increment=1, order=True)
would default to session parameter NOORDER_SEQUENCE_AS_DEFAULTTRUE
by default which would always setNOORDER
instead of what is being set in the column definition.For us, this lead to discrepancies between ORM defined models and the Snowflake state seen by Alembic.