If you don't have a primary key in your object model you should use key_names.
Don't rely on the object ID's that are given.

To update an object in the datastore you first retrieve it with a query.
Change the members of the object.
and put the object back

phrase = Phrases.get_by_id(2)
# or
phrase = Phrases.get_by_key_name('my_key_2')

phraseContent = 'typing a longer phrase'
phraseContent.put()


2009/4/4 Larkin2 <[email protected]>:
>
> I've been reviewing the example provided here:
> http://code.google.com/appengine/kb/commontasks.html#update in regards
> to updating a record in my DB.
>
> I have the following DB model
>
> class Phrases(db.Model,):
>  phraseContent = db.StringProperty(multiline=True)
>
> Assuming the following records exist
>
> ID | phraseContent
> ---------------------------
> 1 | before a window
> 2 | typing a phrase
> 3 } into a computer
>
> How would I update #2 to read: 'typing a longer phrase'
>
> without creating a new record all together?
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to