feat: new join argument for transaction and related functions#381
Merged
chrisrossi merged 2 commits intogoogleapis:masterfrom Apr 3, 2020
Merged
feat: new join argument for transaction and related functions#381chrisrossi merged 2 commits intogoogleapis:masterfrom
join argument for transaction and related functions#381chrisrossi merged 2 commits intogoogleapis:masterfrom
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ndb.transctionnow accepts a boolean argument,join, whichdetermines behavior when called in the context of an already running
transaction. If
joinisTrue, the already running transaction isused, otherwise an exception is raises, as before.
For
transactionandtransaction_async, the default forjoinisFalse, so passing nothing retains the old behavior. For thetransactional,transactional_async, andtransactional_taskletdecorators the default for
joinisTrue, which makes the functionsdecorated 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