redisgraph-py icon indicating copy to clipboard operation
redisgraph-py copied to clipboard

Feature Request: Support double dot param names

Open B-Stefan opened this issue 4 years ago • 7 comments

Thanks for all the work on this project!

I tried to integrate RedisGraph into an existing project(prov-db-connector) and got an unexpected error:

The following command with params will cause an exception because the param name contains and :

Example to reproduce

 params = {'prefix:purpose': "pleasure"}
 query = """MATCH (p:person)-[v:visited {purpose:$purpose}]->(c:country)
                   RETURN p.name, p.age, v.purpose, c.name"""
result = graph.query(query, params)

The code above produces the following query and exception

Exception

social CYPHER prefix:purpose="pleasure" MATCH (p:person)-[v:visited {purpose:$purpose}]->(c:country)
        		   RETURN p.name, p.age, v.purpose, c.name
redis.exceptions.ResponseError: errMsg: Invalid input ':': expected '=' line: 1, column: 14, offset: 13 errCtx: CYPHER prefix:purpose="pleasure" MATCH (p:person)-[v:visited {purpose:$purpos... errCtxOffset: 13

Expected behavior

The example above should be saved successfully to Redis

Potential solution

The library should escape/encode params and queries.

What do you think about this issue? If you need any help to reproduce or investigate this issue, please let me know!

B-Stefan avatar Dec 28 '19 20:12 B-Stefan

Generally speaking including : within the parameter name is a bit confusing as a parameter is defined as a key : value pair. Assuming setting the parameter works, how would you refer to it? RETURN $prefix:purpose probably won't work, This is what I'm getting from Neo4j:

RETURN $prefix:purpose
Neo.ClientError.Statement.ParameterMissing
Expected parameter(s): prefix

swilly22 avatar Mar 17 '20 19:03 swilly22

Yeah, I agree, it is not best-practice but still allowed to address via ``. Example query I wrote 2 years ago:

MATCH (x {`meta:identifier`: 'some'})-[r *1]-(y)

B-Stefan avatar Mar 17 '20 19:03 B-Stefan

Just want to ask if this issue is still open or do you think a new evaluation would be promising due to a complete rewrite/improvement of the library during the last year?

B-Stefan avatar Dec 06 '20 14:12 B-Stefan

Sorry @B-Stefan this issue is still open, I'm able to create an attribute with : in its name but was unable to define a parameter with : in its name.

swilly22 avatar Dec 07 '20 07:12 swilly22

Happy new year to everybody. I just revisited an open issue on the prov-db-connector, and I want to ask if this issue is still open or resolved in a release of redisgraph-py?

B-Stefan avatar Jan 06 '22 11:01 B-Stefan

Hi, I believe the issue is still open, @jeffreylovitz would you mind taking a look ?

swilly22 avatar Jan 07 '22 07:01 swilly22

Hi @B-Stefan,

This is a parser-level issue, rather than being scoped to redisgraph-py.

I've written a fix, and we should be able to merge it into the master branch within a few days!

jeffreylovitz avatar Jan 07 '22 18:01 jeffreylovitz