I have created an Entity, called "Event" in the Google Cloud Datastore for my project. The entity has an ID generated by AppEngine followed by two properties
- Location
- Date
I am trying to query this entity by its ID (5629499534213120), so , here is my code.
key = 5629499534213120
e = Event.get_by_id(key)
logging.info("Event Location = %s" % e.Location)
The value of e is NoneType.
code
__author__ = 'vinayjoseph'
from google.appengine.ext import ndb
import logging
class Event(ndb.Model):
"""Models an individual event at xxx xxxx """
Date = ndb.DateTimeProperty()
Location = ndb.StringProperty()
def get_meeting_date():
"""gets the next meeting date from the No SQL Schemaless Google Datastore
"""
key = 5629499534213120
e = Event.get_by_id(key)
logging.info("Event Location = %s" % e.Location)
e is NoneType
In the datastore I see the following at https://console.developers.google.com/project/apps~xxxxx/datastore/editentity?key=xxxxx%2FEvent%20id:5629499534213120

I suspect the problem might be with my key.
When I try to query the datastore in development using dev_appserver.py it works. I am using a different key for dev.
def get_meeting_date():
"""gets the next meeting date from the No SQL Schemaless Google Datastore
"""
#dev
key = 6401356696911872
#prd
#key = 5629499534213120
e = Event.get_by_id(key)
logging.info("Event Location = %s" % e.Location)


