Are there any circumstances under which GAE datastore might change a property type from StringProperty to TextProperty (effectively ignoring the model definition)?
Consider the following situation (simplified):
class MyModel(db.Model):
user_input = db.StringProperty(default='', multiline=True)
Some entity instances of this model in my datastore have a datatype of TextProperty for 'user_input' (rather than simple str) and are therefore not indexed. I can fix this by retrieving the entity, setting model_instance.user_input = str(model_instance.user_input) and then putting the entity back into the datastore.
What I don't understand is how this is happening to only some entities, when there have been no changes to this model. Is it possible that the'type' of a db.model's property can be overridden from StringProperty to TextProperty?
setattrcan bypass the model definition when a property of a different type is assigned, see my answer below. - HorseloverFatputand thengetthe entity from datastore. If you add this to your example (as per my modified answer), the id's ofstring_typeandtext_typewill be unique . - HorseloverFat