Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7043662
Introduce API Redesign
bigmontz Jul 20, 2022
3db7a70
Add execute
bigmontz Jul 20, 2022
c4d2c89
QueryResult as a named tuple
bigmontz Jul 20, 2022
e0c879c
it's automatic
bigmontz Jul 20, 2022
d0293e7
Add transaction.query to async
bigmontz Jul 21, 2022
5d52bab
Add Session.execute to async
bigmontz Jul 21, 2022
26b19a9
Add AsyncSession.query
bigmontz Jul 21, 2022
e3b1223
Add AsyncDriver.execute()
bigmontz Jul 21, 2022
5759926
Add AsyncDriver.query
bigmontz Jul 21, 2022
7fe9204
re-generate sync driver
bigmontz Jul 21, 2022
7896b06
Apply suggestions from code review
bigmontz Jul 21, 2022
9de9924
Apply suggestions
bigmontz Jul 21, 2022
2c7004c
apply more review suggestions
bigmontz Jul 21, 2022
62fb7ae
apply more review suggestions
bigmontz Jul 21, 2022
056ac54
docs
bigmontz Jul 21, 2022
915875d
Apply suggestions from code review
bigmontz Jul 21, 2022
7af3bd9
Apply suggestions from code review
bigmontz Jul 21, 2022
b6fcfb2
Apply code suggestions
bigmontz Jul 21, 2022
7fb2afd
Apply suggestions from code review
bigmontz Jul 22, 2022
6d5e550
Apply code review suggestions
bigmontz Jul 22, 2022
ed575f9
code suggestions
bigmontz Jul 22, 2022
8bb4498
Extracting known params to the method signatures
bigmontz Jul 22, 2022
b64b3c8
Reformat
bigmontz Jul 22, 2022
cc875d2
parameters=parameters
bigmontz Jul 22, 2022
0e8cbfc
parameters=parameters 2
bigmontz Jul 22, 2022
ecf966f
Apply suggestions from code review
bigmontz Jul 22, 2022
0ad6459
Single param tx function and extracting parameters
bigmontz Jul 25, 2022
a8d541f
Docs
bigmontz Jul 26, 2022
d147e62
code-style + run make-unasync
robsdedude Aug 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions neo4j/_async/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ async def supports_multi_db(self):
await session._connect(READ_ACCESS)
return session._connection.supports_multiple_databases

async def query(self, query, parameters=None,
database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
skip_records=False,
**kwargs):
async def query(
self, query, parameters=None, database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS, skip_records=False,
**kwargs
):
"""
Run a Cypher query within an managed transaction.

Expand Down Expand Up @@ -431,10 +431,11 @@ async def query(self, query, parameters=None,
**kwargs
)

async def execute(self, transaction_function, *args,
database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs):
async def execute(
self, transaction_function, *args,
database=None, cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs
):
"""Execute a unit of work in a managed transaction.

This transaction will automatically be committed unless an exception
Expand Down
24 changes: 15 additions & 9 deletions neo4j/_async/work/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ async def run(self, query, parameters=None, **kwargs):

return self._auto_result

async def query(self, query, parameters=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
skip_records=False,
**kwargs):
async def query(
self, query, parameters=None,
cluster_member_access=CLUSTER_AUTO_ACCESS, skip_records=False,
**kwargs
):
"""
Run a Cypher query within an managed transaction.

Expand All @@ -275,20 +276,25 @@ async def query(self, query, parameters=None,

async def job(tx, **job_kwargs):
if skip_records:
result = await tx.run(query, parameters, **job_kwargs)
result = await tx.run(
query,
parameters=parameters,
**job_kwargs
)
summary = await result.consume()
return QueryResult([], summary)
return await tx.query(query, parameters, **job_kwargs)
return await tx.query(query, parameters=parameters, **job_kwargs)

return await self.execute(
job,
cluster_member_access=cluster_member_access,
**kwargs
)

async def execute(self, transaction_function, *args,
cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs):
async def execute(
self, transaction_function, *args,
cluster_member_access=CLUSTER_AUTO_ACCESS, **kwargs
):
"""Execute a unit of work in a managed transaction.

This transaction will automatically be committed unless an exception
Expand Down
19 changes: 10 additions & 9 deletions neo4j/_sync/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ def supports_multi_db(self):
session._connect(READ_ACCESS)
return session._connection.supports_multiple_databases

def query(self, query, parameters=None,
database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
skip_records=False,
**kwargs):
def query(
self, query, parameters=None, database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS, skip_records=False,
**kwargs
):
"""
Run a Cypher query within an managed transaction.

Expand Down Expand Up @@ -431,10 +431,11 @@ def query(self, query, parameters=None,
**kwargs
)

def execute(self, transaction_function, *args,
database=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs):
def execute(
self, transaction_function, *args,
database=None, cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs
):
"""Execute a unit of work in a managed transaction.

This transaction will automatically be committed unless an exception
Expand Down
24 changes: 15 additions & 9 deletions neo4j/_sync/work/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ def run(self, query, parameters=None, **kwargs):

return self._auto_result

def query(self, query, parameters=None,
cluster_member_access=CLUSTER_AUTO_ACCESS,
skip_records=False,
**kwargs):
def query(
self, query, parameters=None,
cluster_member_access=CLUSTER_AUTO_ACCESS, skip_records=False,
**kwargs
):
"""
Run a Cypher query within an managed transaction.

Expand All @@ -275,20 +276,25 @@ def query(self, query, parameters=None,

def job(tx, **job_kwargs):
if skip_records:
result = tx.run(query, parameters, **job_kwargs)
result = tx.run(
query,
parameters=parameters,
**job_kwargs
)
summary = result.consume()
return QueryResult([], summary)
return tx.query(query, parameters, **job_kwargs)
return tx.query(query, parameters=parameters, **job_kwargs)

return self.execute(
job,
cluster_member_access=cluster_member_access,
**kwargs
)

def execute(self, transaction_function, *args,
cluster_member_access=CLUSTER_AUTO_ACCESS,
**kwargs):
def execute(
self, transaction_function, *args,
cluster_member_access=CLUSTER_AUTO_ACCESS, **kwargs
):
"""Execute a unit of work in a managed transaction.

This transaction will automatically be committed unless an exception
Expand Down