Skip to content

datastore query docs don't use datastore.Query shortcuts #704

@jgeewax

Description

@jgeewax

See http://googlecloudplatform.github.io/gcloud-python/latest/datastore-queries.html#gcloud.datastore.query.Query.fetch

The snippet is

>>> from gcloud.datastore.query import Query
>>> query = Query('dataset-id', 'Person')
>>> query.add_filter('name', '=', 'Sally')
>>> list(query.fetch())
[<Entity object>, <Entity object>, ...]
>>> list(query.fetch(1))
[<Entity object>]

I'd expect it to be

>>> from gcloud import datastore
>>> query = datastore.Query('Person') # note no dataset id
>>> query.add_filter('name', '=', 'Sally')
>>> list(query.fetch())
[<Entity object>, <Entity object>, ...]
>>> list(query.fetch(1))
[<Entity object>]

and a separate example for a specific dataset

>>> from gcloud import datastore
>>> dataset = datastore.Dataset('dataset-id')
>>> query = dataset.Query('Person')
>>> query.add_filter('name', '=', 'Sally')
>>> list(query.fetch())
[<Entity object>, <Entity object>, ...]
>>> list(query.fetch(1))
[<Entity object>]

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions