In google’s datastore I am trying to save myself some writes by making index=False and make reads a little more efficient by only using get_by_id(). I have an entity that I only ever look up with get_by_id(). I know that if I have :
class Comments(db.Model)
content = db.StringProperty(required=True, indexed=False)
userID = db.StringProperty(required = True)
time_created = db.DateTime(autoCreate = True)
that it will take less writes and less space but can I still do the get_by_id() query or is the ID the index?
P.S. I know this is another question but for a simple model like this would having it be ndb.Model be better?
db.get_by_id and get.by_key_name are just convenience wrappers around db.get(key),
They just create the key for you. This type of access does not look at the properties
or their indexes.
You will always be able to the retrieve the entity (if it exists 😉 by the key.