Entitity returned as an one entity item list, not just an entity

11 views
Skip to first unread message

thstart

unread,
Jan 19, 2012, 4:40:10 PM1/19/12
to google-a...@googlegroups.com
I am fetching one record's key like this.
The result I got in 'profile' is a list containing 
one entity. I was expecting the result the be an entity,
not a one item list.
=======================================================================
key = google_db.GqlQuery('SELECT __key__ FROM LMN WHERE n_name = :1',
                           n_name).fetch(1)
profile = db.get(key)

=======================================================================
To get the entity I have to do this:

profile=profile[0]


What is wrong?


Andreas

unread,
Jan 19, 2012, 4:48:32 PM1/19/12
to google-a...@googlegroups.com
fetch() returns a list with entities, get() returns the first entity found by the query.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/gqMr673YCT8J.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

thstart

unread,
Jan 19, 2012, 4:53:55 PM1/19/12
to google-a...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages