Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update app engine entity

How to update existing record in app engine.

like image 557
GoldenBird Avatar asked Nov 26 '22 23:11

GoldenBird


1 Answers

As long as an entity has a key defined it will be updated on put():

record = Record(value='foo')
# This creates a new record
record.put()

record.value = 'shmoo'
# This updates it
record.put()

key = record.key()
record2 = Record.get(key)
record2.value = 'bar'
# Yet again this updates the same record
record2.put()
like image 94
Michal Chruszcz Avatar answered Dec 05 '22 04:12

Michal Chruszcz