Skip to content

Rename Session.x_transaction to Session.execute_x #784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

robsdedude
Copy link
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.
Copy link
Contributor

@gjmwoods gjmwoods left a comment

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