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

Add support for JSONField #23

Closed
timgraham opened this issue Nov 20, 2021 · 9 comments · Fixed by #54
Closed

Add support for JSONField #23

timgraham opened this issue Nov 20, 2021 · 9 comments · Fixed by #54
Assignees

Comments

@timgraham
Copy link
Collaborator

I believe VARIANT is the data type to use with Django's JSONField, however, Snowflake requires using INSERT INTO ... SELECT to insert data, which I'm not sure Django has hooks to handle.

There's a snowflake-connector-python issue (snowflakedb/snowflake-connector-python#244) to add support for INSERT INTO... (without SELECT).

@javedsyedgithub
Copy link

@timgraham we need support added for variant, array list and last insert object for Snowflake in the django project. Our deployment is at standstill without these changes. Could you take this on priority?

@javedsyedgithub
Copy link

@timgraham we need this support added to build our connectors for Snowpark and to help our customers moved to Snowflake who are using Django. We can't move forward until this ticket is resolved and django community is a wide community that Snowflake can't afford to loose.

@javedsyedgithub
Copy link

javedsyedgithub commented Feb 21, 2023

@timgraham do you have any update on this request? We and our customers can't move forward with Snowflake onboarding as this is the blocker. We need this issue fix ASAP for us to keep moving for building our app on the Snowflake platform. We are building our connectors on Snowpark and need to host our app through django with Snowflake as a database and this will help our customers have Snowflake as the underline database for all of our subscription. We really need to get this done sooner than later. Would you able to provide an ETA on this? We need this by next week otherwise unfortunately we need to switch our tech stack from Snowflake as it seems we are not getting the support that we should have.

@timgraham
Copy link
Collaborator Author

I'm not sure it's possible to implement without snowflakedb/snowflake-connector-python#244 which requires non-trivial server-side changes according to @sfc-gh-mkeller. I'll post an update if I find a workaround for this project or hear an ETA on snowflakedb/snowflake-connector-python#244.

@timgraham
Copy link
Collaborator Author

There appears to be hope to implement this without changes in Snowflake and Snowflake Connector Python.

As suggested in snowflakedb/snowflake-connector-python#244 (comment), I'm overriding Django's SQLInsertCompiler to generate queries of the form
insert into t(c1,c2,c3) select column1, column2, parse_json(column3) from values(%s, %s, %s) when JSONField is involved.

Now I'm working through Django's model_fields.test_jsonfield, implementing the various query lookups. I'll update on the progress sometime next week.

@timgraham timgraham self-assigned this Feb 24, 2023
@javedsyedgithub
Copy link

@timgraham thanks for the information, I am looking forward for a fix on this

@javedsyedgithub
Copy link

@timgraham do you have any update on this?

@timgraham
Copy link
Collaborator Author

The pull request linked above your comment is mostly completed. I've been waiting for some feedback from Snowflake engineering on a few remaining questions.

timgraham added a commit that referenced this issue Apr 8, 2023
@javedsyedgithub
Copy link

javedsyedgithub commented Apr 10, 2023 via email

timgraham added a commit that referenced this issue Apr 14, 2023
timgraham added a commit that referenced this issue Apr 14, 2023
timgraham added a commit that referenced this issue Apr 15, 2023
timgraham added a commit that referenced this issue Apr 16, 2023
timgraham added a commit that referenced this issue Apr 16, 2023
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 a pull request may close this issue.

2 participants