I'm trying to write a generic function to take a Cypher query and a dictionary of parameters and be able to dynamically run any given query. What I have looks like this:
def _run_cypher(tx, cypher, params = {}):
results = []
tx.run(cypher, parameters=params)
With queries that look like this:
'CREATE INDEX ON :$label(filemd5)'
And passing params as
params = {'label': label}
I get this error:
Invalid input '$': expected whitespace or a label name (line 1, column 18 (offset: 17))
"CREATE INDEX ON :$label(filemd5)"
Either I am going wrong, or in this context you can't pass a dict of named parameters to tx.run()...can anyone set me straight? Thanks!