Can I db.put models without db.getting them first?
- by Liron
I tried to do something like
ss = Screenshot(key=db.Key.from_path('myapp_screenshot', 123), name='flowers')
db.put([ss, ...])
It seems to work on my dev_appserver, but on live I get this traceback:
05-07 09:50PM 19.964 File "/base/data/home/apps/quixeydev3/12.341796548761906563/common/appenginepatch/appenginepatcher/patch.py",
line 600, in put
E 05-07 09:50PM 19.964 result = old_db_put(models, *args, **kwargs)
E 05-07 09:50PM 19.964 File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/init.py",
line 1278, in put
E 05-07 09:50PM 19.964 keys = datastore.Put(entities, rpc=rpc)
E 05-07 09:50PM 19.964 File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py",
line 284, in Put
E 05-07 09:50PM 19.965 raise _ToDatastoreError(err)
E 05-07 09:50PM 19.965 InternalError: the new entity or index
you tried to insert already exists
I happen to know just the ID of an existing Screenshot entity I want to update; that's why I was manually constructing its key. Am I doing it wrong?