- Notifications
You must be signed in to change notification settings - Fork342
Add pipeline snippets for Firestore#919
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 ourterms of service andprivacy 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?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
| # [START pipeline_concepts] | ||
| pipeline=client.pipeline() \ | ||
| .collection("cities") \ | ||
| .where(Field.of("population").greater_than(100000)) \ |
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.
suggestion: Python lets you break up large numbers, so you could do100_000 for readability (and consider this for other large numbers in this file)
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.
Done here and throughout
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| default_app=firebase_admin.initialize_app() | ||
| client=firestore.client(default_app,"your-new-enterprise-database") | ||
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.
We also have anasync 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 forpipeline_initialization_async andbasic_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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| .execute() | ||
| # [END vector_length] | ||
| forresinresult: | ||
| print(res) |
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 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
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.
Will defer to another PR
Uh oh!
There was an error while loading.Please reload this page.
| Field.of("rating").average().as_("avg_rating"), | ||
| groups=[Field.of("genre")] | ||
| ) \ | ||
| .execute() |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Consider adding more imports for Vector, and others that may be missing through the file
But overall LGTM
Uh oh!
There was an error while loading.Please reload this page.
morganchen12 commentedNov 11, 2025
After adding the snippets for expressions and inputs, I'm getting these errors: For the errors:
|
daniel-sanche commentedNov 11, 2025
It looks like there's anout-dated docstring. I can fix that. Let me know if you think it's important to have
|
Uh oh!
There was an error while loading.Please reload this page.
No description provided.