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

SNOW-584971: fetch_pandas_all returns JSON columns as string not dict #1115

Closed
kbroughton opened this issue May 3, 2022 · 1 comment · May be fixed by #1121
Closed

SNOW-584971: fetch_pandas_all returns JSON columns as string not dict #1115

kbroughton opened this issue May 3, 2022 · 1 comment · May be fixed by #1121

Comments

@kbroughton
Copy link

I believe this is similar to several other issues and PRs:

  1. What version of Python are you using?

python 3.9.7

  1. What operating system and processor architecture are you using?

Linux-5.10.47-linuxkit-x86_64-with-glibc2.31

  1. What are the component versions in the environment (pip freeze)?
    Built wheel using:
    ci/build_docker.sh
    which generates
    snowflake_connector_python-2.7.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

  2. What did you do?

Create a DB with json data.
I check that it is being stored in a JSON friendly format because i can query the data using : dotted access

cursor = ctx.cursor().execute(f"""
    SELECT 
      *
    FROM MYDATASET.PUBLIC.MYTABLE_VARIANT
    WHERE DATA:jsonPayload:bytes_sent > 3500
    LIMIT 2
    """)
result = cursor.fetch_pandas_all()
print(type(result['DATA'].iloc[0]), result['DATA'].iloc[0])

The output shows that it is <class 'str'>.

<class 'str'> {
  "insertId": "sb2haif1xnn2k",
  "jsonPayload": {
    "bytes_sent": "0",
    "connection": {
      "dest_ip": "2xx.85.147.95",
      "dest_port": "443",
      "protocol": "6",
      "src_ip": "10.128.0.xx",
      "src_port": "48516"
    },
  1. What did you expect to see?

I expected that the dataframe column for DATA would automatically convert to JSON, in this case: <class 'dict'>.

If I use the Snowflake UI, I can copy the DATA column and it pastes as JSON. It also displays as JSON.

  1. Can you set logging to DEBUG and collect the logs?

I don't think this is necessary since this is less a bug than a feature request. However, i marked it as a bug because I think it is a bug with respected to everybody's expectation of how it would work, and related to the many issues raised over fetch_pandas_all() not respecting schema.

@github-actions github-actions bot changed the title fetch_pandas_all returns JSON columns as string not dict SNOW-584971: fetch_pandas_all returns JSON columns as string not dict May 3, 2022
@github-actions github-actions bot added the Stale label Mar 10, 2023
@github-actions
Copy link

To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of March 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant