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

Pager not made for list_collection_ids proto on firestore, seems heuristic may be incorrect? #516

Closed
crwilcox opened this issue Jul 10, 2020 · 2 comments
Assignees

Comments

@crwilcox
Copy link
Contributor

def collections(self):
        """List top-level collections of the client's database.

        Returns:
            Sequence[:class:`~google.cloud.firestore_v1.collection.CollectionReference`]:
                iterator of subcollections of the current document.
        """
        iterator = self._firestore_api.list_collection_ids(
            request={"parent": "{}/documents".format(self._database_string)},
            metadata=self._rpc_metadata,
        )
        iterator.client = self
        iterator.item_to_value = _item_to_collection_ref
        return iterator

This code is how we used ot use the list_collection_ids. However, it is no longer a pager/iterator.

https://github.com/googleapis/googleapis/blob/master/google/firestore/v1/firestore.proto#L842

@software-dov
Copy link
Contributor

It looks like the problem is that the generator is expecting that APIs will only paginate over messages, not primitives. The repeated element for ListCollectionIdsResponse is a collection of strings, and so the heuristic ignores it.
I don't know if this was an oversight or a deliberate decision when implementing the generator logic. I'll check to see if there are any tests that would support one hypothesis or another.

@software-dov
Copy link
Contributor

FIxed by #517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants