Add pipeline snippets for Firestore#919
Conversation
|
|
||
| default_app = firebase_admin.initialize_app() | ||
| client = firestore.client(default_app, "your-new-enterprise-database") | ||
|
|
There was a problem hiding this comment.
We also have an async version of everything.
Often, we re-write the samples for both sync and async, and show both options in the language selection pickers. I'm not sure how you want to handle that here.
Maybe a couple samples for pipeline_initialization_async and basic_read_async is enough to show it exists, since the API is almost identical. Or maybe samples for async aren't needed for preview
There was a problem hiding this comment.
I will try to get to the async versions after Java and if I don't get to it by launch day it'll just be a follow-on.
| .execute() | ||
| # [END vector_length] | ||
| for res in result: | ||
| print(res) |
There was a problem hiding this comment.
It would be great if we could have a test file that exercises these functions. Even just running them without verifying outputs would be helpful to make sure no exceptions are thrown, but reading back results would be ideal
It looks like the other samples in this repo aren't tested though, so maybe that would be too much to set up
| Field.of("rating").average().as_("avg_rating"), | ||
| groups=[Field.of("genre")] | ||
| ) \ | ||
| .execute() |
There was a problem hiding this comment.
If you want to get rid of all the \, IIRC think you could do something like this:
results = (
client.pipeline()
.collection("books")
.aggregate(
Field.of("rating").average().as_("avg_rating"),
groups=[Field.of("genre")]
).execute()
)
(But test it first)
daniel-sanche
left a comment
There was a problem hiding this comment.
Consider adding more imports for Vector, and others that may be missing through the file
But overall LGTM
|
After adding the snippets for expressions and inputs, I'm getting these errors: For the errors:
|
It looks like there's an out-dated docstring. I can fix that. Let me know if you think it's important to have
|
* add fid arg and token deprecate warning to Message class and add unit tests * add fids to MulticastMessage and token deprecate warning and add unit tests * Fix lint formatting error * Position `tokens` first to guarantee backward compatibility for legacy positional arguments and add a unit test for it * Extract multicast-to-message-list conversion logic into a private helper function * Add docstring for the helper function * Add unit tests for the async function, change deprecate message and address other review comments * Fix error messages and MulticastMessage constructor and add mix types of fids and tokens * Add integration tests for fid as argument * Update integration tests error code for invalid fid target
…redential (#954) Added a universe_domain property override to MockGoogleComputeEngineCredential in tests/testutils.py to prevent unexpected network requests to the GCE metadata server during test runs with newer versions of google-auth.
Updates the requirements on [pyjwt](https://github.com/jpadilla/pyjwt) to permit the latest version. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst) - [Commits](jpadilla/pyjwt@2.10.1...2.12.1) --- updated-dependencies: - dependency-name: pyjwt dependency-version: 2.12.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yvonne Pan <103622026+yvonnep165@users.noreply.github.com>
Updates the requirements on [google-cloud-firestore](https://github.com/googleapis/google-cloud-python) to permit the latest version. - [Release notes](https://github.com/googleapis/google-cloud-python/releases) - [Changelog](https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-documentai/CHANGELOG.md) - [Commits](googleapis/google-cloud-python@google-cloud-firestore-v2.23.0...google-cloud-firestore-v2.27.0) --- updated-dependencies: - dependency-name: google-cloud-firestore dependency-version: 2.27.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yvonne Pan <103622026+yvonnep165@users.noreply.github.com>
Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@8.2.2...8.4.2) --- updated-dependencies: - dependency-name: pytest dependency-version: 8.4.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yvonne Pan <103622026+yvonnep165@users.noreply.github.com>
No description provided.