Jackery Xu
Jackery Xu

Reputation: 402

How do I query from Google App Engine in python

I need to query a kind K in my project P in python where the kinds can be seen on https://ah-builtin-python-bundle-dot-P.appspot.com/

from google.cloud import datastore

client = datastore.client.Client(project='P')
query = client.query(kind='K')
print list(query.fetch(1))

running this does not return anything, it just gets stuck on the last line

Upvotes: 0

Views: 81

Answers (1)

Thomas Kowalski
Thomas Kowalski

Reputation: 2184

You should be creating your client with

client = datastore.Client(project = "myProjectName")

And not

client = datastore.client.Client(project = "myProjectName")

Upvotes: 1

Related Questions