I have the following code:

entities = db.GqlQuery("SELECT __key__ FROM mymodel").fetch(300)
keys = {}
while entities:
    for key in entities:
        if key in keys.keys():
            keys[key] = keys[key] + 1
        else:
            keys[key] = 1
    entities = db.GqlQuery("SELECT __key__ FROM mymodel WHERE __key__
> :1", entities[-1]).fetch(300)

Now, the thing that I don't get is that when I look at the "keys"
dictionary above, I get something like that:

agxhcHBjYWRkeWxpdmVyHgsSD01vZGVsX21vYmlsZWFwcCIJMzM4Njk0OTU0DA  128
agxhcHBjYWRkeWxpdmVyHgsSD01vZGVsX21vYmlsZWFwcCIJMzM4NzI2NTg4DA  139
agxhcHBjYWRkeWxpdmVyHgsSD01vZGVsX21vYmlsZWFwcCIJMjg0OTQ4OTg1DA  1

ie. some keys are fetched multiple times from the db? How is that
possible? I must be making a simple mistake, but I don't find it. I
read that all queries without exlicit ordering are ordered by __key__
asc by default, so that shouldn't be the problem. What's wrong with my
logic here?!

I should say that all mymodel objects are created with

obj = mymodel( key_name = 'some_unique_id', [...] )

if that's of any significance.

Thanks in advance,
Benjamin

--

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-appeng...@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=.


Reply via email to