Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-28-2020 03:00 PM
So I have a working Cypher query within python which can query my Neo4j database and return a result when a property key value is hardcoded. It looks like this:
piq = """MATCH (p:Person {bid: '123456789'}), blah blah blah """
with driver.session() as session:
profile_info = session.run(piq).values()
What I want to do is replace that string value with a parameter:
bid = 123456789
so the query text becomes something like
piq = """MATCH (p:Person {bid: bid}), blah blah blah """
I have tried $bid
, {bid}
, and also specifying things in the session.run
area but just can't seem to find the correct syntax.
Any help, would be appreciated, and I would rather not try to install py2neo as I have had enough of the driver conflicts.
07-28-2020 03:16 PM
Hello @FourMoBro
with ctx.session() as ses:
profile_info = ses.run("MATCH (p:Person {bid: $bid}), blah blah blah ", bid=bid)
Regards,
Cobra
07-28-2020 03:21 PM
Thanks @Cobra. I was close, but I also had another error in my code.
I also needed to have bid=str(123456789)
I love how fast this community responds!
07-28-2020 03:22 PM
Oh yeah sorry, I didn't see it was a string
All the sessions of the conference are now available online