-
Notifications
You must be signed in to change notification settings - Fork 78
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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, |
There was a problem hiding this comment.
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
google/cloud/firestore_v1/client.py
Outdated
@@ -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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
LGTM, but let's hold off on merging it until the async is ready |
…#1059) * feat: Added read_time as a parameter to various calls (async classes) * used TYPE_CHECKING; fixed unit tests * linting + fixing cover * final linting
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