To add to that, I tried to use the download_data tool to get a csv
dump of my datastore entities. It runs fine, until eventually it hits
this:

[ERROR   ] [Thread-11] ExportProgressThread:
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py", line 1385, in run
    self.PerformWork()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py", line 2127, in PerformWork
    item.progress_key = self.db.StoreKeys(item.key_start,
item.key_end)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/bulkloader.py", line 1926, in StoreKeys
    repr(key_start), repr(key_end))
AssertionError: datastore_types.Key.from_path(u'Model_mobileapp',
u'286532250', _app_id_namespace=u'appcaddylive') not less than
datastore_types.Key.from_path(u'Model_mobileapp', u'284152154',
_app_id_namespace=u'appcaddylive')

so, something seems a bit broken there. If it helps, I have the
following indexes defined for Model_mobileapp:

indexes:
- kind: Model_mobileapp
  properties:
  - name: __key__
    direction: desc

Because the bulkloader used to complain that it needs a descending
index on key for parallel downloads.

On Nov 15, 3:28 pm, bsb <[email protected]> wrote:
> Just to say, the following query gives me the correct result:
>
> entities = mymodel.all().order('myId').fetch(300)
> keys = {}
> while entities:
>     for obj in entities:
>         if obj.myId in keys.keys():
>             keys[obj.myId] = keys[obj.myId] + 1
>         else:
>             keys[obj.myId] = 1
>     entities = mymodel.all().order('myId').filter('myId >', entities
> [-1].myId).fetch(300)
>
> So why does the key-based query not work?
>
> On Nov 15, 3:08 pm, bsb <[email protected]> wrote:
>
>
>
> > 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 [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=.


Reply via email to