@@ -152,8 +152,7 @@ Example Application
152
152
class App :
153
153
154
154
def __init__ (self , uri , user , password ):
155
- # Aura queries use an encrypted connection
156
- self .driver = GraphDatabase.driver(uri, auth = (user, password), encrypted = True )
155
+ self .driver = GraphDatabase.driver(uri, auth = (user, password))
157
156
158
157
def close (self ):
159
158
# Don't forget to close the driver connection when you are finished with it
@@ -177,12 +176,12 @@ Example Application
177
176
# The Reference Card is also a good resource for keywords,
178
177
# see https://neo4j.com/docs/cypher-refcard/current/
179
178
180
- query = """
181
- CREATE (p1:Person { name: $person1_name })
182
- CREATE (p2:Person { name: $person2_name })
183
- CREATE (p1)-[:KNOWS]->(p2)
184
- RETURN p1, p2
185
- """
179
+ query = (
180
+ " CREATE (p1:Person { name: $person1_name }) "
181
+ " CREATE (p2:Person { name: $person2_name }) "
182
+ " CREATE (p1)-[:KNOWS]->(p2) "
183
+ " RETURN p1, p2"
184
+ )
186
185
result = tx.run(query, person1_name = person1_name, person2_name = person2_name)
187
186
try :
188
187
return [{" p1" : record[" p1" ][" name" ], " p2" : record[" p2" ][" name" ]}
@@ -201,17 +200,17 @@ Example Application
201
200
202
201
@ staticmethod
203
202
def _find_and_return_person (tx , person_name ):
204
- query = """
205
- MATCH (p:Person)
206
- WHERE p.name = $person_name
207
- RETURN p.name AS name
208
- """
203
+ query = (
204
+ " MATCH (p:Person) "
205
+ " WHERE p.name = $person_name "
206
+ " RETURN p.name AS name"
207
+ )
209
208
result = tx.run(query, person_name = person_name)
210
209
return [record[" name" ] for record in result]
211
210
212
211
if __name__ == " __main__" :
213
212
# See https://neo4j.com/developer/aura-connect-driver/ for Aura specific connection URL.
214
- scheme = " neo4j"
213
+ scheme = " neo4j" # Connecting to Aura, use the "neo4j+s" URI scheme
215
214
host_name = " example.com"
216
215
port = 7687
217
216
url = " {scheme} ://{host_name} :{port} " .format(scheme = scheme, host_name = host_name, port = port)
0 commit comments