Skip to content

feat: new join argument for transaction and related functions#381

Merged
chrisrossi merged 2 commits intogoogleapis:masterfrom
chrisrossi:feature-366
Apr 3, 2020
Merged

feat: new join argument for transaction and related functions#381
chrisrossi merged 2 commits intogoogleapis:masterfrom
chrisrossi:feature-366

Conversation

@chrisrossi
Copy link
Contributor

ndb.transction now accepts a boolean argument, join, which
determines behavior when called in the context of an already running
transaction. If join is True, the already running transaction is
used, otherwise an exception is raises, as before.

For transaction and transaction_async, the default for join is
False, so passing nothing retains the old behavior. For the
transactional, transactional_async, and transactional_tasklet
decorators the default for join is True, which makes the functions
decorated with these composable, by default. This means a decorated
function can call another decorated function and the second call will
just use the already running transaction.

Closes #366

`ndb.transction` now accepts a boolean argument, `join`, which
determines behavior when called in the context of an already running
transaction. If `join` is `True`, the already running transaction is
used, otherwise an exception is raises, as before.

For `transaction` and `transaction_async`, the default for `join` is
`False`, so passing nothing retains the old behavior. For the
`transactional`, `transactional_async`, and `transactional_tasklet`
decorators the default for `join` is `True`, which makes the functions
decorated with these composable, by default. This means a decorated
function can call another decorated function and the second call will
just use the already running transaction.

Closes googleapis#366
@chrisrossi chrisrossi requested a review from cguardia April 3, 2020 17:48
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 3, 2020
Copy link
Contributor

@cguardia cguardia left a comment

Choose a reason for hiding this comment

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

Looking good, thanks.

@chrisrossi chrisrossi merged commit 2c91685 into googleapis:master Apr 3, 2020
@chrisrossi chrisrossi deleted the feature-366 branch April 3, 2020 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested Transaction workaround

3 participants