Skip to content

Rename Session.x_transaction to Session.execute_x - #784

Merged
robsdedude merged 2 commits into
neo4j:5.0from
robsdedude:rename-tx-func-api
Aug 30, 2022
Merged

robsdedude merged 2 commits into
neo4j:5.0from
robsdedude:rename-tx-func-api

Conversation

@robsdedude

Copy link
Copy Markdown
Member

Deprecate Session.read_transaction and Session.write_transaction in favor
of Session.execute_read and Session.execute_write respectively.

Other drivers had to rename this function as there was a breaking change in the
API. Namely, transaction functions getting passed a managed transaction object
that has not commit/rollback/... methods, but can only run queries. The same
change also applies to the Python driver but it's not breaking as the driver
would've failed later (with a rather cryptic error coming from the server) when
the user tried to manually commit/rollback/... a managed transaction inside a
transaction function.

Deprecate `Session.read_transaction` and `Session.write_transaction` in favor
of `Session.execute_read` and `Session.execute_write` respectively.

Other drivers had to rename this function as there was a breaking change in the
API. Namely, transaction functions getting passed a managed transaction object
that has not commit/rollback/... methods, but can only run queries. The same
change also applies to the Python driver but it's not breaking as the driver
would've failed later (with a rather cryptic error coming from the server) when
the user tried to manually commit/rollback/... a managed transaction inside a
transaction function.

@gjmwoods gjmwoods left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@robsdedude
robsdedude merged commit a13bdc6 into neo4j:5.0 Aug 30, 2022
robsdedude added a commit to robsdedude/neo4j-python-driver that referenced this pull request Aug 31, 2022
Amends neo4j#784
There were other mentions/usages of `Session.read/write_transaction` that needed
replacing with `Session.execute_read/write`.

While there was a test to make sure the example in the README works, there was
no assertion the test actually tests what's in the README. Added a test to
assert the former test resembles the README example.
robsdedude added a commit that referenced this pull request Aug 31, 2022
Amends #784
There were other mentions/usages of `Session.read/write_transaction` that needed
replacing with `Session.execute_read/write`.

While there was a test to make sure the example in the README works, there was
no assertion the test actually tests what's in the README. Added a test to
assert the former test resembles the README example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants