Skip to content
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

[Firestore] Refactor Python Transaction layer to better match other SDKs. #6557

Closed
crwilcox opened this issue Nov 16, 2018 · 5 comments · Fixed by #8628
Closed

[Firestore] Refactor Python Transaction layer to better match other SDKs. #6557

crwilcox opened this issue Nov 16, 2018 · 5 comments · Fixed by #8628
Assignees
Labels
api: firestore Issues related to the Firestore API. triaged for GA type: process A process-related concern. May include testing, release, or the like.

Comments

@crwilcox
Copy link
Contributor

crwilcox commented Nov 16, 2018

The Transaction API is vastly different: Instead of offering a Transaction type and a run_transaction() function, a transaction object has to be passed as an optional argument to all WriteBatch methods.

b/76423649

@crwilcox crwilcox added api: firestore Issues related to the Firestore API. triaged for GA labels Nov 16, 2018
@tseaver
Copy link
Contributor

tseaver commented Nov 16, 2018

run_in_transaction is a Spanner-only construct. datastore offers Transaction as a subclass of Batch, and handles the get-a-transaction-id dance in its __enter__. See: https://googleapis.github.io/google-cloud-python/latest/datastore/transactions.html

@JustinBeckwith JustinBeckwith added the triage me I really want to be triaged. label Nov 17, 2018
@tseaver tseaver added the type: process A process-related concern. May include testing, release, or the like. label Nov 19, 2018
@JustinBeckwith JustinBeckwith removed the triage me I really want to be triaged. label Nov 19, 2018
@crwilcox crwilcox self-assigned this Nov 20, 2018
@crwilcox
Copy link
Contributor Author

Assigning myself. I need to figure out what this exactly means.

@crwilcox crwilcox assigned mcdonc and unassigned mcdonc Jan 15, 2019
@tseaver tseaver assigned tseaver and unassigned mcdonc Jan 29, 2019
@tseaver
Copy link
Contributor

tseaver commented Feb 4, 2019

FTR:

  • Spanner uses a "unit of work" callback, and then runs it in a loop under the covers to handle the various ABORTED bits which can be triggered during either reads (by the UoW callable) or at commit time.
  • Datastore exposes using its Batch and Transaction objects as context managers: commit happens if the with block exits without raising an exception.

Firestore basically follows Datastore's pattern.

@crwilcox
Copy link
Contributor Author

crwilcox commented Feb 4, 2019

I think matching the datastore semantics makes the most sense here.

@crwilcox
Copy link
Contributor Author

crwilcox commented Jun 3, 2019

@tseaver, if you can prioritize looking into this? Other clients have get and getAll

https://github.com/googleapis/nodejs-firestore/blob/d307e465aaf8a2709ae0822075488ecb481babf7/dev/src/transaction.ts#L184

So, we would like to add a transaction.getAll(documentReferences) call. Also probably a transaction.get(documentReference) call.

node also supports queryReferences to get. It may be good to do the same in python.

@crwilcox crwilcox added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Jun 3, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 4, 2019
@sduskis sduskis removed 🚨 This issue needs some love. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. triaged for GA type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants