If you use the (undocumented) underlying datastore API you will get
datastore objects as lists of dictionary-like objects. It is the
higher level datastore API that converts these objects into Models.
Consequently, using this API is slightly faster as well. For example

from google.appengine.api import datastore

q = datastore.Query("SomeKind", {"name =": "someName"}, None, False,
True, None) # Kind, query, ?, keys_only, compile, cursor
q_results = q.Run()

for result in q_results:
  print result.key()
  print result['name']

The only mechanism I have found to understand this API is to review
the app engine code.  The documentation in the code is pretty
reasonable, but generally no examples.

On Apr 15, 1:17 pm, Lynge <[email protected]> wrote:
> Hi, I am using an Expando class and I want to sort it.
> It needs to be sorted according to a dynamically assigned property so
> it has o be done at runtime.
>
> I am using python and it could be done easily with something like:
>
>         dates = sorted(datelist, key=itemgetter('comp_date'))
>
> But since the objects returned from the datastore are not iterable
> this is impossible.
>
> So I thought that I would just create my own list of dicts and then I
> can iterate and sort it, but alas that is not possible either.
>
> I can iterate over the primary just fine
>
>         for date in datesfromdb:
>             datelist.append(dict(date))
>
> but no matter how I try to get the data out of the date object I have
> no luck.
> I dont want to name all the properties of the model since that would
> make it a big pain to update anything, but how then do I do it?
>
> Any help would be appreciated.

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