Step 2:

    entity = Note.get_by_id(id)

which is actually a shortcut for:

    entity = Note.get(db.Key.from_path('Note', id))

or, if you insist on using GQL:

    entity = Note.gql('WHERE __key__ = :1',
                      db.Key.from_path('Note', id)).get()

...but it's less efficient.

Step 3:

    entity.column = my_value
    entity.put()

You don't have to iterate on query results if you expect to get
exactly one entity.

Hope this helps.

Cheers,
Alex
--
www.muspy.com


On Jan 11, 5:16 pm, BigMouth Li <jsonic1...@gmail.com> wrote:
> Hi:
>
> In PHP:
> get the id likehttp://...?id=2,and:
> mysql_query(update Note set coulm='value' where id='$_GET[id]')
>
> In Google app engine:
> step 1:
> id=int(self.request.get('id')) #get ID
>
> step 2: (does not work!)
> -----------------------------------------------------
> query = db.GqlQuery("SELECT * FROM Note WHERE key = :1", id) #get
> Entity by 'GET method ID'?
> -----------------------------------------------------
>
> step 3:
> for c in query:
>    c.colum = self.request.get('value')
>    .....
> db.put(query)
>
> Is anyone help me? Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to