Add pipeline snippets for Firestore
After adding the snippets for expressions and inputs, I'm getting these errors:
(.venv) morganchen-mac:firebase-admin-python morganchen$ ./lint.sh
Running linter on snippets/firestore/firestore_pipelines.py
************* Module snippets.firestore.firestore_pipelines
snippets/firestore/firestore_pipelines.py:1770:20: E1101: Module 'firebase_admin.firestore' has no 'SERVER_TIMESTAMP' member (no-member)
snippets/firestore/firestore_pipelines.py:2009:41: E1101: Class 'Expression' has no 'array' member (no-member)
snippets/firestore/firestore_pipelines.py:2010:16: E1101: Class 'Expression' has no 'array' member (no-member)
snippets/firestore/firestore_pipelines.py:2288:12: E1101: Instance of 'Field' has no 'array_get' member (no-member)
For the errors:
- I'm not sure why I'm getting this error, it seems to be invoked correctly based on our docs
- I'm also not sure why I'm getting this error since Array is documented here
- See 2
- The
array_getmethod seems to just be missing from the Python SDK. @daniel-sanche this is likely me not reading something somewhere, but just in case it was overlooked
-
One of those is
from google.cloud import firestore, and the other isfrom firebase_admin import firestore. I'm not super familiar with thefirebase_adminwrapper, but I don't think those are fully equivalent -
In the end, I think Array was actually implemented as a stand-alone class:
from google.cloud.firestore_v1.pipeline_expressions import Array
Array(["bar", Field.of("baz")])
It looks like there's an out-dated docstring. I can fix that.
Let me know if you think it's important to have array exposed on Expression as well though. I removed it in an effort to keep the API surface manageable, instead of exposing multiple ways of expressing the same thing. But I can add it back if that's more consistent with other languages.
- array_get was a late addition, but it should be in the preview branch as of yesterday. Maybe try running again