cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Parameters work everywhere except in the relation specifier block [...]

    def addArrowToDatabase(self, arrow):
        cql = "MATCH (s),(t)\n" \
            "WHERE id(s)={srcid} AND id(t)={tarid}\n" \
            "CREATE (s)-[r:snake {name:name}]->(t)\n" \
            "RETURN id(r)"
        try:
            self.connectToDatabase()
            with self.dbDriver.session() as session:
                id = session.run(cql, parameters={
                                     'snake': arrow.snake_case_def(),
                                     'name' : arrow.name(),
                                     'srcid': arrow.sourceNode().databaseID(),
                                     'tarid': arrow.targetNode().databaseID(),
                                     }).single().value()
            arrow.setDatabaseID(id)
        except Exception as e:
            Error(str(e)).exec_()
            if __debug__:
                raise ef __debug__:
>                 raise e

My cypher query is put together in python. Using braces {..} inside of [...] is not working so how would one specify parameters inside of [...]?

2 REPLIES 2

You can use $name which is the newer syntax of parameters

also the "[r:snake {name:{name}}]" not working will rather be a python issue than a Cypher one.

Thanks, Michael. I think the code (with your corrections) works now or am about to test it.