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

Commit time and write results aren't set after the transaction is committed via decorated transactional function #927

Open
rostyq opened this issue Jul 1, 2024 · 0 comments · May be fixed by #928
Assignees
Labels
api: firestore Issues related to the googleapis/python-firestore API.

Comments

@rostyq
Copy link

rostyq commented Jul 1, 2024

Currently, it is not possible to check transformation results after a successful transaction run in a decorated function without additional read access to firestore database.

Environment details

  • OS type and version: Windows 11
  • Python version: 3.12.0
  • pip version: 24.1.1
  • google-cloud-firestore version: 2.16.1

Steps to reproduce

  1. Implement a @transactional (or @async_transactional) function using any firestore transforms (for example SERVER_TIMESTAMP)
  2. Run a successful Transaction (or AsyncTransaction) in the decorated function
  3. Access commit_time and write_results

Code example

from google.cloud.firestore_v1.client import Client
from google.cloud.firestore_v1.transaction import Transaction, transactional
from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP

client = Client()

@transactional
def run(t: Transaction):
    t.set(client.document("examples/example"), {"server_timestamp": SERVER_TIMESTAMP})

t = client.transaction()

run(t)

print(t.commit_time)
print(t.write_results)
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Jul 1, 2024
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 googleapis/python-firestore API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants