snowflakedb / snowflakedb/snowflake-connector-python

SNOW-720936: Arrays with nulls return invalid JSON for null values

Open
#1,388 8 comments 3 reactions 1 assignee View on GitHub

@sfc-gh-mkeller is already working on this.

Since Mar 29, 2023.

feature status-triage_done triaged
Dominant language
Python
Stars
730
Forks
574
Avg merge
5h 45m
Merged PRs (30d)
16

Description

  1. What version of Python are you using?
❯ python --version --version
Python 3.10.9 (main, Dec  6 2022, 18:44:57) [GCC 11.3.0]
  1. What operating system and processor architecture are you using?
❯ python -c 'import platform; print(platform.platform())'
Linux-5.15.86-x86_64-with-glibc2.35
  1. What are the component versions in the environment (pip freeze)?
❯ poetry show snowflake-sqlalchemy
 name         : snowflake-sqlalchemy
 version      : 1.4.4
 description  : Snowflake SQLAlchemy Dialect

❯ poetry show snowflake-connector-python
 name         : snowflake-connector-python
 version      : 2.9.0
 description  : Snowflake Connector for Python
  1. What did you do?
In [19]: import sqlalchemy as sa

In [20]: con = sa.create_engine(...)

In [21]: [(row,)] = con.execute('select array_construct(1,2,null)')

In [22]: row
Out[22]: '[\n  1,\n  2,\n  undefined\n]'

In [23]: import json

In [24]: json.loads(row)
  1. What did you expect to see?

    I think I'd expect to see null (and then None from the result of the parse done by json.loads). null is a valid JSON value while undefined is not.

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

    I don't think doing this helps, as the query succeeds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.