Skip to content

broken sample code in docs for create/where #477

@MichaelDausmann

Description

@MichaelDausmann

the example code in this file...

https://github.com/neo4j/neo4j-python-driver/blob/8f708fe9374f7e6bdfdf84ff611f266a8a5e9344/docs/source/index.rst

specifically:-

def create_friend_of(tx, name, friend):
    tx.run("CREATE (a:Person)-[:KNOWS]->(f:Person {name: $friend}) "
           "WHERE a.name = $name "
           "RETURN f.name AS friend", name=name, friend=friend)

is incorrect and breaks because you cannot use create with a Where Clause

should instead match then create..

def create_friend_of(tx, name, friend):
    tx.run("Match (a:Person{name:$name}) "
    "With a "
    "CREATE (a)-[:KNOWS]->(f:Person {name: $friend}) "
    "RETURN f.name AS friend", name=name, friend=friend)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions