Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-25-2021 10:26 PM
Hi, I am trying to get the user id after inserting the node, but I dont see the value in the result object. Being new, I am confident I am missing something obvious. PL note that the node is in the db and the result summary object shows the nodes created. can you please help?
def insert_gdbuser(self, email_address, password):
driver = NeoDB.get_session()
user_id = uuid.uuid4()
result = driver.write_transaction(
lambda tx: tx.run(
"CREATE (u:User {email_address:$email_address, password:$password, user_id:$user_id})"
" RETURN u.email_address, u.user_id",
{"email_address": str(email_address), "password": str(password), "user_id": str(user_id)}))
record = result.single()
info = result.consume().counters.nodes_created
if info > 0 and record is not None:
print("The user id is", record["u.user_id"])
Thanks for your help
07-02-2021 04:08 PM
the result is no longer valid outside of the tx
so inside of the tx you need to return result.single()
07-10-2021 10:02 PM
thanks. figured it out from the docs after I submitted my question. Appreciate your response.
All the sessions of the conference are now available online