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

Support for Snowflake Hybrid Tables #97

Open
davepaulsanders opened this issue May 8, 2024 · 3 comments
Open

Support for Snowflake Hybrid Tables #97

davepaulsanders opened this issue May 8, 2024 · 3 comments

Comments

@davepaulsanders
Copy link

I see in the README under known issues:

"Snowflake doesn’t support last_insert_id to retrieve the ID of a newly created object. Instead, this backend issues the query SELECT MAX(pk_name) FROM table_name to retrieve the ID. "

I am currently struggling with this, and came across Snowflake hybrid tables. I'm wondering if this issue could be resolved by supporting Hybrid Tables creation?

https://docs.snowflake.com/user-guide/tables-hybrid

@timgraham
Copy link
Collaborator

I tried to run Django's test suite with hybrid tables. Initial discoveries:

A hybrid table limitation: "Unique and foreign-key constraints can only be defined at table creation time." This is problematic for Django's schema editor as it uses deferred SQL quite often. I don't know if we can work around this.

Secondly, as you mentioned, I understood the promise of hybrid tables is that we wouldn't have to do SELECT MAX(pk_name) FROM table_name to find the inserted primary key, however, I'm not sure what the method for getting the id with hybrid tables looks like. For most databases, it's cursor.lastrowid but this is still None in snowflake-connector-python. Searching that repo for "hybrid" gives no results, so it's unclear if any changes are in the works.

@mike-prittie
Copy link

Is there any progress on backing Django with Snowflake Hybrid tables?

@timgraham
Copy link
Collaborator

There are no updates since my previous comment.

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

No branches or pull requests

3 participants