Skip to content

support dict as a parameter value on _build_params_header #141

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

Closed
wants to merge 1 commit into from

Conversation

AvitalFineRedis
Copy link
Contributor

No description provided.

@AvitalFineRedis AvitalFineRedis marked this pull request as draft August 9, 2021 08:36
@AvitalFineRedis AvitalFineRedis linked an issue Aug 9, 2021 that may be closed by this pull request
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 9, 2021

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
Copy link

codecov bot commented Aug 9, 2021

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%) ⬇️

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
Copy link
Contributor

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:

  • so that it would be easier to write unit tests for it. (No need to instantiate a Graph,
    no need for a redis connection.)
  • since it would have been a static method anyway, in the Graph class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support dict as a parameter value
2 participants