Reputation: 596
Hello I am taking the web development from Udacity and experimenting google datastore in python and created a simple entity called Blog.
I checked the localhost:admin port, all the ids are like '5249205949956096', it should be '1','2','3' instead as everybody else. Is this supposed to do with my text editor or something else set up wrong besides the codes?
class Blog(db.Model):
subject = db.StringProperty(required = True)
content = db.TextProperty(required =True)
created = db.DateTimeProperty(auto_now_add = True)
class NewPostHandler(Handler):
def get(self):
self.render("newpost.html")
def post(self):
subject = self.request.get("subject")
content = self.request.get("content")
if subject and content:
newblog=Blog(subject=subject,content=content)
newblog_key = newblog.put()
Upvotes: 2
Views: 88
Reputation: 693
They changed the default allocation strategy for ids to scattered (http://googlecloudplatform.blogspot.com/2013/05/update-on-datastore-auto-ids.html). You can override this for the dev_appserver like this:
dev_appserver.py --auto_id_policy=sequential
More in the "Specifying the automatic ID allocation policy" section of the dev server page: https://cloud.google.com/appengine/docs/python/tools/devserver.
But like @dyoo states, nothing to worry about, but you can swap for easier eyeball lookups during local testing.
Upvotes: 3
Reputation: 12023
App Engine has its own allocation strategy for identifiers. You are probably OK. There are APIs for more control over the IDs, but you most likely don't need to worry about them unless your requirements are unusual.
Upvotes: 2