File tree 1 file changed +10
-12
lines changed 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change 3
3
4
4
from neo4j import GraphDatabase , basic_auth
5
5
6
- driver = GraphDatabase .driver (
7
- "neo4j+s://demo.neo4jlabs.com:7687" ,
8
- auth = basic_auth ("mUser" , "s3cr3t" ))
9
-
10
6
cypher_query = '''
11
7
MATCH (m:Movie {title:$movieTitle})<-[:ACTED_IN]-(a:Person) RETURN a.name as actorName
12
8
'''
13
9
14
- with driver .session (database = "movies" ) as session :
15
- results = session .read_transaction (
16
- lambda tx : tx .run (cypher_query ,
17
- movieTitle = "The Matrix" ).data ())
18
- for record in results :
19
- print (record ['actorName' ])
20
-
21
- driver .close ()
10
+ with GraphDatabase .driver (
11
+ "neo4j+s://demo.neo4jlabs.com:7687" ,
12
+ auth = ("mUser" , "s3cr3t" )
13
+ ) as driver :
14
+ result = driver .execute_query (
15
+ cypher_query ,
16
+ movieTitle = "The Matrix" ,
17
+ database_ = "movies" )
18
+ for record in result .records :
19
+ print (record ['actorName' ])
You can’t perform that action at this time.
0 commit comments