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

Enable receiving variant and array types in json

Open sfc-gh-heshah opened this issue 3 years ago • 2 comments

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    SNOW-703036

  2. Fill out the following pre-review checklist:

    • [x] I am adding a new automated test(s) to verify correctness of my new code
    • [ ] I am adding new logging messages
    • [ ] I am adding a new telemetry message
    • [ ] I am modifying authorization mechanisms
    • [ ] I am adding new credentials
    • [ ] I am modifying OCSP code
    • [ ] I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Use json.loads to try to load array and variant types in the connector. Some observed behaviors:

    • If parse_json is used on a list ending with a comma, for example [1, 2, 3,], Snowflake stores it as [1, 2, 3, undefined]
    • If null is passed to array_construct, it is stored as undefined in the array.
    • json.loads cannot parse undefined elements in VARIANT or ARRAY types.

sfc-gh-heshah avatar Dec 08 '22 00:12 sfc-gh-heshah

Codecov Report

Merging #1371 (303384d) into main (580c0ae) will decrease coverage by 0.47%. The diff coverage is 27.14%.

@@            Coverage Diff             @@
##             main    #1371      +/-   ##
==========================================
- Coverage   81.29%   80.82%   -0.48%     
==========================================
  Files          61       62       +1     
  Lines        8553     8619      +66     
  Branches     1262     1274      +12     
==========================================
+ Hits         6953     6966      +13     
- Misses       1281     1334      +53     
  Partials      319      319              
Impacted Files Coverage Δ
src/snowflake/connector/json_decoder.py 17.74% <17.74%> (ø)
src/snowflake/connector/converter.py 89.89% <100.00%> (+0.10%) :arrow_up:
src/snowflake/connector/cache.py 84.51% <0.00%> (-0.68%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Dec 15 '22 01:12 codecov-commenter

Is this PR still viable? Would be happy to look into any remaining issues to get this merged.

srilman avatar Mar 12 '23 17:03 srilman