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

Get realtime updates with Cloud Firestore with asyncio #5078

Closed
Podolyan98 opened this issue Dec 14, 2020 · 1 comment
Closed

Get realtime updates with Cloud Firestore with asyncio #5078

Podolyan98 opened this issue Dec 14, 2020 · 1 comment
Assignees
Labels
api: firestore Issues related to the Firestore API. samples Issues that are directly related to samples.

Comments

@Podolyan98
Copy link

Hi. How can I run this example through asyncio? The error I got on startup:

name col_snapshot is not defined

sample:

    async def on_snapshot(col_snapshot, changes, read_time):
        for change in changes:
            if change.type.name == 'ADDED':
                response = f'New document: {change.document.id}'
                logger.debug(response)
            elif change.type.name == 'MODIFIED':
                response = f'Modified document: {change.document.id}'
                logger.debug(response)
            elif change.type.name == 'REMOVED':
                response = f'Removed document: {change.document.id}'
                logger.debug(response)
                delete_done.set()

    col_query = db.collection(u'cities')
    query_watch = col_query.on_snapshot(await on_snapshot(col_snapshot, changes, read_time))
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Dec 14, 2020
@busunkim96 busunkim96 added the api: firestore Issues related to the Firestore API. label Dec 14, 2020
@busunkim96 busunkim96 assigned crwilcox and unassigned leahecole Dec 14, 2020
@crwilcox
Copy link
Contributor

Deduping this with googleapis/python-firestore#131.

Watch is currently not supported on the async surface as it is a background thread today and wasn't as obvious a benefit to adding async.

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 Firestore API. samples Issues that are directly related to samples.
Projects
None yet
Development

No branches or pull requests

4 participants