Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

feat: Added read_time as a parameter to various calls (synchronous/base classes) - #1050

Merged
gkevinzheng merged 16 commits into
mainfrom
read-time-redux
Jun 4, 2025
Merged

feat: Added read_time as a parameter to various calls (synchronous/base classes)#1050
gkevinzheng merged 16 commits into
mainfrom
read-time-redux

Conversation

@gkevinzheng

@gkevinzhenggkevinzheng commented May 13, 2025

Copy link
Copy Markdown
Contributor

This PR is a rewrite of #1013 that's basically the same PR. After a rebase added unnecessary commits to the PR, I decided to rewrite it.

Fixes#775

@gkevinzheng
gkevinzheng requested review from a team and daniel-sancheMay 13, 2025 18:47
@product-auto-labelproduct-auto-labelBot added the size: l Pull request size is large. label May 13, 2025
@product-auto-labelproduct-auto-labelBot added the api: firestore Issues related to the googleapis/python-firestore API. label May 13, 2025
@gkevinzhenggkevinzheng linked an issue May 21, 2025 that may be closed by this pull request
@gkevinzhenggkevinzheng added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@gkevinzhenggkevinzheng added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@cindy-pengcindy-peng removed their assignment May 21, 2025

@daniel-sanchedaniel-sanche left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like the async classes are missing? We should change this in both places

Other than that, looks good

retry: retries.Retry | object | None = gapic_v1.method.DEFAULT,
timeout: float | None = None,
*,
read_time: Optional[datetime.datetime] = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: The other arguments use | None instead of Optional

Comment threadgoogle/cloud/firestore_v1/client.py Outdated
retry: retries.Retry | object | None = gapic_v1.method.DEFAULT,
timeout: float | None = None,
*,
read_time: Optional[datetime.datetime] = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about the async versions of these classes?

@gkevinzhenggkevinzhengMay 22, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Would adding the async stuff bloat this PR? I was going to add the async options in another PR, similar to what was done with ExplainOptions.

assert set(collection.list_documents()) == set()

data1 = {"foo": "bar"}
update_time1, document_ref1 = collection.add(data1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like all the tests are using times directly read back from the API. It might be good to have some explictly-constructed datetimes as well?

Edit: It looks like the unit tests cover this. Might be good to have as a system test too, but I don't think that matters too much, as long as its tested somewhere

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Added a parameter to generate datetime.datetime.now objects.

@daniel-sanche

Copy link
Copy Markdown
Contributor

LGTM, but let's hold off on merging it until the async is ready

daniel-sanche
daniel-sanche previously approved these changes May 23, 2025
daniel-sancheand others added 2 commits May 23, 2025 16:24
…#1059)
* feat: Added read_time as a parameter to various calls (async classes)
* used TYPE_CHECKING; fixed unit tests
* linting + fixing cover
* final linting
@product-auto-labelproduct-auto-labelBot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels May 27, 2025
daniel-sanche
daniel-sanche previously approved these changes Jun 3, 2025
fix no cover comment
daniel-sanche
daniel-sanche previously approved these changes Jun 3, 2025
@gkevinzheng
gkevinzheng merged commit d8e3af1 into mainJun 4, 2025
@gkevinzheng
gkevinzheng deleted the read-time-redux branch June 4, 2025 17:59
@release-pleaserelease-pleaseBot mentioned this pull request Jun 4, 2025
daniel-sanche added a commit that referenced this pull request Jun 9, 2025
commit 0ff25c1
Merge: dc5b5ac22b558c
Author: Daniel Sanche <sanche@google.com>
Date: Mon Jun 9 14:38:14 2025 -0700
Merge branch 'pipeline_queries_1_stubs' into pipeline_queries_2_query_parity
commit 22b558c
Merge: b46bdc1dc808b5
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Mon Jun 9 14:16:25 2025 -0700
Merge branch 'pipeline_queries_approved' into pipeline_queries_1_stubs
commit dc808b5
Merge: 3f9b65f7f96290
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Mon Jun 9 13:43:53 2025 -0700
Merge branch 'main' into pipeline_queries_approved
commit 7f96290
Author: Daniel Sanche <sanche@google.com>
Date: Fri Jun 6 11:14:43 2025 -0700
chore: enable mypy testing (#1057)
commit d8e3af1
Author: Kevin Zheng <147537668+gkevinzheng@users.noreply.github.com>
Date: Wed Jun 4 13:59:27 2025 -0400
feat: Added read_time as a parameter to various calls (synchronous/base classes) (#1050)
* feat: Added read_time as a parameter to various calls (synchronous/base classes)
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* fixed tests + added system tests
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* Removed specific system test assertions
* added system test with python datetimes
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* revised type hints
* linting
* feat: Added read_time as a parameter to various calls (async classes) (#1059)
* feat: Added read_time as a parameter to various calls (async classes)
* used TYPE_CHECKING; fixed unit tests
* linting + fixing cover
* final linting
* TYPE_CHECKING
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* Update client.py
fix no cover comment
* fixed async system test
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Sanche <sanche@google.com>
commit 437e233
Author: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Date: Wed May 28 09:56:14 2025 -0700
chore(main): release 2.21.0 (#1055)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
commit 0fb4f2d
Author: Daniel Sanche <sanche@google.com>
Date: Fri May 23 14:31:46 2025 -0700
chore: update renovate.json (#1058)
commit 6c81626
Author: Jing <lscmirror@gmail.com>
Date: Fri May 23 09:46:58 2025 -0700
feat: Support Sequence[float] as query_vector in FindNearest (#908)
commit b01a03c
Author: Daniel Sanche <sanche@google.com>
Date: Thu May 22 17:42:51 2025 -0700
chore(tests): system test for unicode characters (#1003)
commit f8bf2af
Author: Daniel Sanche <sanche@google.com>
Date: Thu May 22 16:16:19 2025 -0700
chore: add java 21 to fix emulator tests (#1056)
commit 5a279b2
Author: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed May 21 06:35:29 2025 -0400
chore: Update gapic-generator-python to 1.25.0 (#1043)
* chore: Update gapic-generator-python to 1.25.0
PiperOrigin-RevId: 755914147
Source-Link: googleapis/googleapis@97a83d7
Source-Link: googleapis/googleapis-gen@a9977ef
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTk5NzdlZmVkYzgzNmNjZWNlMWYwMWQ1MjliMDMxNWUxZWZlNTJhZCJ9
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
commit 043d9ef
Author: Jeff Verkoeyen <jeff@clutch.engineering>
Date: Tue May 20 17:37:28 2025 -0700
fix: Add missing DocumentReference return value to .document (#1053)
commit dc5b5ac
Merge: 5beee36b46bdc1
Author: Daniel Sanche <sanche@google.com>
Date: Thu May 15 16:49:40 2025 -0700
Merge branch 'pipeline_queries_1_stubs' into pipeline_queries_2_query_parity
commit 5beee36
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Thu May 15 16:47:24 2025 -0700
ran blacken
commit c8cfcee
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Thu May 15 16:44:30 2025 -0700
added tests
commit f22f11e
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Thu May 15 16:35:40 2025 -0700
support tuples in pipelin_source.collection
commit 63b83b8
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Thu May 15 15:43:31 2025 -0700
added tests for expressions
commit c4cd995
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 17:31:55 2025 -0700
added tests for filter conditions
commit 2775da2
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 17:04:20 2025 -0700
improve FilterCondition repr
commit a9368b3
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 15:58:09 2025 -0700
added stages unit tests
commit 28fd42d
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 15:28:04 2025 -0700
added tests
commit b46bdc1
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 15:02:46 2025 -0700
fixed test issues
commit d2babd2
Merge: 2d286bb3f9b65f
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Tue May 13 11:25:51 2025 -0700
Merge branch 'pipeline_queries_approved' into pipeline_queries_1_stubs
commit 3f9b65f
Author: Daniel Sanche <d.sanche14@gmail.com>
Date: Thu May 8 14:07:16 2025 -0700
chore: updated gapic layer for execute_query
daniel-sanche added a commit that referenced this pull request Dec 17, 2025
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.
Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
<details><summary>google-cloud-firestore: 2.22.0</summary>
##
[2.22.0](v2.21.0...v2.22.0)
(2025-12-16)
### Features
* support mTLS certificates when available (#1140)
([403afb0](403afb08))
* Expose tags field in Database and RestoreDatabaseRequest public protos
(#1074)
([4983639](49836391))
* Add support for Python 3.14 (#1110)
([52b2055](52b2055d))
* Added read_time as a parameter to various calls (synchronous/base
classes) (#1050)
([d8e3af1](d8e3af1f))
### Bug Fixes
* update the async transactional types (#1066)
([210a14a](210a14a4))
* improve typing (#1136)
([d1c730d](d1c730d9))
</details>
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: firestoreIssues related to the googleapis/python-firestore API.size: xlPull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support read_time queries

4 participants

@gkevinzheng@daniel-sanche@yoshi-kokoro@cindy-peng