0

I am working with Google's Datalab service, on a Google managed Computer engine(default), and I would like to call my Google Datastore's API. The documentation points to using the from google.appengine.ext import db library.

But when I execute this in a datalab code block I get ImportError: No module named appengine.ext.

I realize that this likly means that the App Engine SDK is not installed on the Datalab compute engine, My quetion is how can I then access the My Datastore namespace from my Datalab notebook?

Community
  • 1
  • 1
Chris Molanus
  • 387
  • 3
  • 7

1 Answers1

2

It seems that I was better off using the gcloud package. Seeing as I updated the gcloud package before they where able to update documentation this is an example of the code I used:

from gcloud import datastore
from gcloud.datastore.key import Key
from gcloud.datastore.entity import Entity
import datetime

client = datastore.Client('project_id','namespace')
key = client.key('kind_name')
entity = datastore.Entity(key=key)
entity['datetime'] = datetime.datetime.now()
entity['some_other_column'] = 1

query = datastore.Query(client,kind='kind_name')
for result in query.fetch():
    print result
Chris Molanus
  • 387
  • 3
  • 7