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

(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")

>Solution :

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

Leave a Reply