Search⌘ K

Pass Parameters to Queries

Explore how to enhance Neo4j Cypher queries by passing parameters through Elixir. Learn to modify query functions to accept parameter maps, utilize callbacks for flexibility, and execute dynamic queries for nodes and string searches. Understand the benefits of parameterized queries for reuse and faster execution, supported by practical examples with historic ARPANET graphs.

Why query with parameters?

Cypher supports querying with parameters. This simplifies query reuse and makes caching of execution plans easier, in turn leading to faster query execution times.

Parameters as map

The Bolt.Sips module allows us to pass our parameters as a map in a third argument to the query/3 function. (The first argument is the database connection, and the second is the query string.)

But the query functions we have created so far just ...