I am using the Python SDK for Google App Engine, and bottle.
Running something simple like this to set up some entities to work with:
@bottle.route('/test')
def testing():
Statistic(team_id = 2, qty_customers = 600).put()
Statistic(team_id = 3, qty_customers = 5).put()
return "Done."
Statistic looks like this:
class Statistic(ndb.Model):
team_id = ndb.IntegerProperty()
qty_customers = ndb.IntegerProperty()
I would expect it to create one entity for each of those, and add them to the datastore. It creates two copies of each and adds them to the datastore.
How can I make the code only add one entity?
Why is it creating two?
Edit: To clarify, I am running the testing() function once, and it creates 4 entities. Two duplicates of each.
Statisticclass to the question? Does it inherit fromdb.Modelor fromndb.Model? - barak manostestinginside this class as a@staticmethod? - barak manos