RedisGraph / redisgraph-py

RedisGraph python client
https://redisgraph.io
BSD 3-Clause "New" or "Revised" License
189 stars 49 forks source link

support dict as a parameter value on `_build_params_header` #141

Closed AvitalFineRedis closed 2 years ago

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

codecov[bot] commented 3 years ago

Codecov Report

Merging #141 (5bbb6c3) into master (bb300e1) will decrease coverage by 0.56%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
- Coverage   85.46%   84.90%   -0.57%     
==========================================
  Files           8        8              
  Lines         523      530       +7     
==========================================
+ Hits          447      450       +3     
- Misses         76       80       +4     
Impacted Files Coverage Δ
redisgraph/graph.py 85.43% <66.66%> (-2.07%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bb300e1...5bbb6c3. Read the comment docs.

skieffer commented 3 years ago

I think we need a recursive procedure, so that dictionaries occurring within a parameter value are also rendered without quotation marks around keys.

For example, we want this to work:

graph.query("""
    UNWIND $props as prop
    CREATE (c:Cat)
    SET c = prop
""", {
    'props': [
        {'age': 2, 'color': 'orange'},
        {'age': 7, 'color': 'gray'},
    ]
})

Therefore I'm proposing this pull request.

I put the stringifying function in the util module instead of the Graph class: