Skip to content
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

Typing documents? #364

Closed
louis030195 opened this issue Jun 6, 2021 · 1 comment
Closed

Typing documents? #364

louis030195 opened this issue Jun 6, 2021 · 1 comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@louis030195
Copy link

Is your feature request related to a problem? Please describe.

In TypeScript and Flutter Firestore SDK you read/write typed documents, it is much more maintainable IMHO, I wonder if something similar would be possible on the Python SDK?

I am kind of new to Python typing, so I hope what I propose is actually possible? Otherwise, I would gladly learn something from my mistake.

Describe the solution you'd like

import os
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

class Foo:
    def __init__(self):
        self.bar = "baz"
 
cred = credentials.Certificate(os.environ["GOOGLE_APPLICATION_CREDENTIALS"])
firebase_admin.initialize_app(cred)
firestore_client: BaseClient = firestore.client()
foos_ref: BaseCollectionReference = firestore_client.collection(u"foos")

for foo in foos_ref.stream().with_converter(Foo):
    print(foo.bar)
    

Describe alternatives you've considered

No type

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Jun 6, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 8, 2021
@kolea2 kolea2 added the type: question Request for information or clarification. Not an issue. label Jun 9, 2021
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Jun 9, 2021
@tseaver tseaver added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. labels Jul 13, 2021
@Mariatta Mariatta added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Nov 10, 2022
@meredithslota
Copy link
Contributor

Closing in favor of #447 as these are related. Thanks!

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. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

6 participants