[google-appengine] Re: Entity not updating
Thank you so much!! On Sep 13, 12:13 pm, Ben Nevile wrote: > No, this is wrong. Your GQL query wasn't working because you didn't > get() or fetch() a result. > > uProfile = PROFILES.gql('...').get() > > On Sep 12, 4:13 pm, Larkin2 wrote: > > > I think I answered my own question - I'm retrieving a result set > > with .gql - to update an entity I need to specifically grab it with > > get_by_id() or get_by_key()... > > > so for example: > > > profileToUpdate = PROFILES.gql("WHERE user = :1", user) > > updatedProfile = profileToUpdate[0].key().id() > > uProfile = PROFILES.get_by_id(updatedProfile) > > uProfile.name = self.request.get('name2') > > db.put(uProfile) > > > On Sep 12, 6:53 pm, Larkin2 wrote: > > > > uProfile = PROFILES.gql("WHERE user = :1", user) > > > uProfile[0].name = self.request.get('name2') > > > db.put(uProfile) > > > > I've been racking my brain for several hours on this - is there > > > anything in the code above that would prevent this particular entity > > > in PROFILES from not being updated? I can't get the entity to update > > > for the life of me. > > > > Thanks > > > > Larkin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[google-appengine] Re: Entity not updating
No, this is wrong. Your GQL query wasn't working because you didn't get() or fetch() a result. uProfile = PROFILES.gql('...').get() On Sep 12, 4:13 pm, Larkin2 wrote: > I think I answered my own question - I'm retrieving a result set > with .gql - to update an entity I need to specifically grab it with > get_by_id() or get_by_key()... > > so for example: > > profileToUpdate = PROFILES.gql("WHERE user = :1", user) > updatedProfile = profileToUpdate[0].key().id() > uProfile = PROFILES.get_by_id(updatedProfile) > uProfile.name = self.request.get('name2') > db.put(uProfile) > > On Sep 12, 6:53 pm, Larkin2 wrote: > > > > > uProfile = PROFILES.gql("WHERE user = :1", user) > > uProfile[0].name = self.request.get('name2') > > db.put(uProfile) > > > I've been racking my brain for several hours on this - is there > > anything in the code above that would prevent this particular entity > > in PROFILES from not being updated? I can't get the entity to update > > for the life of me. > > > Thanks > > > Larkin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[google-appengine] Re: Entity not updating
I think I got your problem. Thanks for the elegant self-solving. On Sep 13, 7:13 am, Larkin2 wrote: > I think I answered my own question - I'm retrieving a result set > with .gql - to update an entity I need to specifically grab it with > get_by_id() or get_by_key()... > > so for example: > > profileToUpdate = PROFILES.gql("WHERE user = :1", user) > updatedProfile = profileToUpdate[0].key().id() > uProfile = PROFILES.get_by_id(updatedProfile) > uProfile.name = self.request.get('name2') > db.put(uProfile) > > On Sep 12, 6:53 pm, Larkin2 wrote: > > > > > uProfile = PROFILES.gql("WHERE user = :1", user) > > uProfile[0].name = self.request.get('name2') > > db.put(uProfile) > > > I've been racking my brain for several hours on this - is there > > anything in the code above that would prevent this particular entity > > in PROFILES from not being updated? I can't get the entity to update > > for the life of me. > > > Thanks > > > Larkin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[google-appengine] Re: Entity not updating
I think I answered my own question - I'm retrieving a result set with .gql - to update an entity I need to specifically grab it with get_by_id() or get_by_key()... so for example: profileToUpdate = PROFILES.gql("WHERE user = :1", user) updatedProfile = profileToUpdate[0].key().id() uProfile = PROFILES.get_by_id(updatedProfile) uProfile.name = self.request.get('name2') db.put(uProfile) On Sep 12, 6:53 pm, Larkin2 wrote: > uProfile = PROFILES.gql("WHERE user = :1", user) > uProfile[0].name = self.request.get('name2') > db.put(uProfile) > > I've been racking my brain for several hours on this - is there > anything in the code above that would prevent this particular entity > in PROFILES from not being updated? I can't get the entity to update > for the life of me. > > Thanks > > Larkin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---