Home > front end >  (parameter) ???: Any "???" is not accessedPylance
(parameter) ???: Any "???" is not accessedPylance

Time:06-23

(parameter) disease: Any "disease" is not accessedPylance

(parameter) drug: Any "drug" is not accessedPylance

{code: Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): disease, drug}

    def add_medicine(tx, disease, drug):
        tx.run("CREATE (m1:Medicine {disease: $disease}) "
            "CREATE (m2:Medicine {drug: $drug}) "
            "CREATE (m1)-[:TREAT]->(m2) "
            "RETURN m1, m2")
            
    with driver.session() as session:
        session.write_transaction(add_medicine,"Fever","Water")

CodePudding user response:

tx.run(
   "CREATE (m1:Medicine {disease: $disease}) "
   "CREATE (m2:Medicine {drug: $drug}) "
   "CREATE (m1)-[:TREAT]->(m2) "
   "RETURN m1, m2",
   disease=disease, drug=drug)
  • Related