snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-228474: Support converting VARIANT to python object

Open roi-meir opened this issue 5 years ago • 10 comments

What is the current behavior?

When querying a variant (or array and object) column the results are returned as dumped json string. In the past before the Arrow format support we used the converter_class parameter to pass our own subclass of SnowflakeConverter that calls json.loads on the returned string. But when using the Arrow format this parameter has no affect

What is the desired behavior?

To be able to control if the results should be a string or a python object (list or dict)

How would this improve snowflake-connector-python?

Either have a way to pass a costume converter class or have another parameter that call json.loads

I will be happy to open a pull request that adds the parameter convert_arrow_variant_to_object that if enabled, call json.loads on variant results.

References, Other Background

roi-meir avatar Nov 21 '20 14:11 roi-meir

idk if it's relevant for you because it's more of a sqlalchemy thing, but we (@anecdotes.ai) managed to work with DELETE/UPDATE/INSERT/SELECT to VARIANT type columns using sqlalchemy's events mechanism (specifically before_cursor_execute).

shahargl avatar Nov 29 '20 09:11 shahargl

Any news on this? As a workaround we currently have a hardcoded list of columns to json.parse in the query "postprocessing".

jonashaag avatar Sep 13 '21 13:09 jonashaag

any update on this issue? we are facing the same problems and currently cannot use Arrow because of this

salexln avatar Mar 24 '22 14:03 salexln

Server-side binding for VARIANT and ARRAY is actively in the works. We didn't want to add support for retrieving them until binding them wasn't supported.

sfc-gh-mkeller avatar Mar 28 '22 17:03 sfc-gh-mkeller

any updates/eta's on when we can expect converting VARIANT/ARRAY to python object? can't use snowflake as my feast offline store if the type conversion doesn't happen

srausser avatar May 30 '22 19:05 srausser

any update on this issue? We are facing the same problems and currently cannot use Arrow as well

YoniMelki avatar Oct 04 '22 10:10 YoniMelki

We will look into prioritizing this work in Q2.

sfc-gh-achandrasekaran avatar Mar 14 '23 18:03 sfc-gh-achandrasekaran

Hi guys! any update on this issue?

KantorSerhiy avatar Jun 14 '23 14:06 KantorSerhiy

hello team, any updates?

vanducng avatar Jan 30 '24 05:01 vanducng

hi all - to my best knowledge server-side thankfully supports VARIANT and ARRAY now, so next step would be the client side ;) at this moment I don't have any timeline to share for this planned enhancement, but will keep this thread posted with every new information . Thank you so much all for bearing with us !

sfc-gh-dszmolka avatar Mar 08 '24 15:03 sfc-gh-dszmolka