I have a hunch. But if it seems to me that I am doing it wrong. I want db.StringProperty () to be a unique identifier. I have a simple db.Model with name and file. If I add another entry with the same name as in db.Model, I want to update this.
As far as I know, I look:
template = Templates.all().filter('name = ', name)
Check if there is another entry:
if template.count() > 0:
Then add it or update. But from what I read .count () is expensive to use the CPU.
Is it possible to set the "name" property as unique, and the data store will automatically update it or another best way to do this?
.. Fredrick
source share