Redisgraph: Using parameters in redis-cli

Created on 26 Apr 2020  路  3Comments  路  Source: RedisGraph/RedisGraph

Hi,

I was reading from Neo4j training material that Cypher has a way to pass parameters to a query (reminds me of prepared statements when dealing with SQL).

The only mention of parameters in the RedisGraph docs is in the Cypher coverage page which only refers to client libraries.

I'd like to know how parameters could be passed to a query via native commands when using redis-cli.

Thanks

question

All 3 comments

Hi @dandago,
You can use Redis MONITOR command to see the commands received by the server.

Regardless, this is how you would specify parameters:

GRAPH.QUERY g "CYPHER a=1; RETURN $a"

Thanks. I suppose these need to be specified for each query that is run.

What are the benefits of using parameters specifically in RedisGraph? Are there any performance/caching and security aspects for instance? Anything else worth mentioning?

Well, for once, if you're query takes an input from users, introducing user input via parameters is much safer then injecting this data directly into the query (think SQL injection)

Moreover @DvirDukhan is almost done working on query caching which will benefit from parametrised queries.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m4g005 picture m4g005  路  9Comments

mdazartash picture mdazartash  路  3Comments

m4g005 picture m4g005  路  3Comments

Sceat picture Sceat  路  6Comments

kkonevets picture kkonevets  路  3Comments