Page Name: datastore-queries Release: 0.10.1 This python code (a close copy of one of the pieces in the tutorials), yields an error: ``` python from gcloud import datastore ds_client = datastore.Client(project='mikes-playground-project') #key = client.key('Person')# #entity = datastore.Entity(key=key) #entity['name'] = 'Your name' #entity['age'] = 25 #client.put(entity) #print("And Out..") query = datastore.Query('Person') query.add_filter('age', '<', '100') list(query.fetch(1), client=ds_client) #even if you remove client=... ``` results in the following error ``` > basilyan@instance-3:~$ python ds.py > Traceback (most recent call last): > File "ds.py", line 12, in <module> > query = datastore.Query('Person') > File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/query.py", line 88, in __init__ > self._project = project or client.project > AttributeError: 'str' object has no attribute 'project' ``` Using Python 2.7 and gcloud (0.10.1)
Activity
dhermes commentedon Mar 1, 2016
@mbasilyan Thanks for filing. The issue is that
should be
Which tutorial are you referring to?
dhermes commentedon Mar 1, 2016
Ahhh I found the error. The docs up to
0.10.1have the error but it is fixed inlatestdhermes commentedon Mar 1, 2016
Was fixed in #1517.
Thanks for noticing and taking the time to let us know!
mbasilyan commentedon Mar 1, 2016
Thanks @dhermes
Setting kind='Person' gives me this code:
Running it, gives me this error:
mbasilyan commentedon Mar 1, 2016
Ahh got it. It's more that it should've been client.query(kind=...) rather than datastore.Client(kind=...)
Fixed it now. Thanks!
dhermes commentedon Mar 1, 2016
Sorry, my snippet was wrong, but the
latestdocs are correct:dhermes commentedon Mar 1, 2016
Jinx!
mbasilyan commentedon Mar 1, 2016
:)
docs: add samples from python-docs-samples/tasks (#36)
docs(client): Fix typo in get_mtls_endpoint_and_cert_source doc (#1552)
chore(librarian): onboard to librarian, including generate (#1552)
chore(main): release 3.4.1 (#1552)
chore(main): release 2.0.0 (#1552)