0

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

1
  • Are you sure the first parameter for fetch is limit? I have the exact same code and it works properly... (except I'm using Flask so I'm not printing but returning a response) Commented May 25, 2017 at 17:40

1 Answer 1

1

You should be creating your client with

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

And not

client = datastore.client.Client(project = "myProjectName")
Sign up to request clarification or add additional context in comments.

3 Comments

TypeError: 'module' object is not callable. I am running on windows 10
That's really weird, the exact line I'm using is c = datastore.Client("project") and it's working right now.
my apologies, I didn't capitalise C in Client, but it didn't change anything

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.