[google-appengine] Re: How to print it?

2009-01-13 Thread David Symonds

On Tue, Jan 13, 2009 at 8:30 PM, arnie parvez...@rediffmail.com wrote:

 Hi all
 For a data model class say
 Person with certain fields,
 how can i access the unique numeric ID field associated with each
 entity in query?
 I use
 persons=db.GqlQuery('SELECT __key__ FROM Person')
 for p in persons:
   self.response.out.write(how to print the ID field here)

self.response.out.write(p.key().id())


Dave.

--~--~-~--~~~---~--~~
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: How to print it?

2009-01-13 Thread Alexander Kojevnikov

  Hi all
  For a data model class say
  Person with certain fields,
  how can i access the unique numeric ID field associated with each
  entity in query?
  I use
  persons=db.GqlQuery('SELECT __key__ FROM Person')
  for p in persons:
    self.response.out.write(how to print the ID field here)

 self.response.out.write(p.key().id())

You should also replace 'SELECT __key__' with 'SELECT *' in your GQL,
you cannot select individual properties.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---