Skip to content

Commit

Permalink
Move example docstring from connection.py->client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed Aug 15, 2016
1 parent 0d0497a commit 72e5823
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
5 changes: 5 additions & 0 deletions gcloud/datastore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ def query(self, **kwargs):
>>> cursor
<string containing cursor where fetch stopped>
Under the hood this is doing:
>>> connection.run_query('project', query.to_protobuf())
[<list of Entity Protobufs>], cursor, more_results, skipped_results
:type **kwargs: dict
:param **kwargs: Parameters for initializing and instance of
:class:`gcloud.datastore.query.Query`.
Expand Down
24 changes: 1 addition & 23 deletions gcloud/datastore/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,7 @@ def run_query(self, project, query_pb, namespace=None,
:meth:`gcloud.datastore.query.Query.fetch` method.
Under the hood, the :class:`gcloud.datastore.query.Query` class
uses this method to fetch data:
>>> from gcloud import datastore
>>> client = datastore.Client()
>>> query = client.query(kind='MyKind')
>>> query.add_filter('property', '=', 'val')
Using the query iterator's
:meth:`next_page() <.datastore.query.Iterator.next_page>` method:
>>> query_iter = query.fetch()
>>> entities, more_results, cursor = query_iter.next_page()
>>> entities
[<list of Entity unmarshalled from protobuf>]
>>> more_results
<boolean of more results>
>>> cursor
<string containing cursor where fetch stopped>
Under the hood this is doing:
>>> connection.run_query('project', query.to_protobuf())
[<list of Entity Protobufs>], cursor, more_results, skipped_results
uses this method to fetch data.
:type project: string
:param project: The project over which to run the query.
Expand Down

0 comments on commit 72e5823

Please sign in to comment.