Skip to content

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

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

gkevinzheng
Copy link
Contributor

@gkevinzheng gkevinzheng commented May 13, 2025

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 a review from daniel-sanche May 13, 2025 18:47
@gkevinzheng gkevinzheng requested review from a team as code owners May 13, 2025 18:47
@product-auto-label product-auto-label bot added the size: l Pull request size is large. label May 13, 2025
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label May 13, 2025
@gkevinzheng gkevinzheng linked an issue May 21, 2025 that may be closed by this pull request
@gkevinzheng gkevinzheng added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@gkevinzheng gkevinzheng added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 21, 2025
@cindy-peng cindy-peng removed their assignment May 21, 2025
Copy link
Contributor

@daniel-sanche daniel-sanche left a comment

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

@@ -365,6 +365,8 @@ def get(
transaction=None,
retry: retries.Retry | object | None = gapic_v1.method.DEFAULT,
timeout: float | None = None,
*,
read_time: Optional[datetime.datetime] = None,
Copy link
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

@@ -261,6 +269,8 @@ def collections(
self,
retry: retries.Retry | object | None = gapic_v1.method.DEFAULT,
timeout: float | None = None,
*,
read_time: Optional[datetime.datetime] = None,
Copy link
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?

Copy link
Contributor Author

@gkevinzheng gkevinzheng May 22, 2025

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
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
Contributor Author

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
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-sanche and 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-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels May 27, 2025
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. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support read_time queries
4 participants