为什么我在1.4 nonrel上获得MultiQuery异常?

时间:2013-08-02 14:23:50

标签: google-app-engine django-nonrel

我正在测试NonRel for App Engine的升级版本从1.3升级到1.4。它在本地工作正常,但是当我部署到App Engine时,我在部署结束时收到了syncdb错误:

Running syncdb.
2013-08-02 09:31:34,600 WARNING simple_search_stub.py:998 Could not read search indexes from /var/folders/fv/cdp4hprx5pbc_3bf5g0wbbkw0000gn/T/dev_appserver.searchindexes
Creating tables ...
The following content types are stale and need to be deleted:

    auth | message

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

    Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/src/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute() 
  File "/src/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/src/djangoappengine/management/commands/deploy.py", line 72, in run_from_argv
    run_appcfg(argv)
  File "/src/djangoappengine/management/commands/deploy.py", line 51, in run_appcfg
    call_command('syncdb', remote=True, interactive=True)
  File "/src/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/src/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/src/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/src/django/core/management/commands/syncdb.py", line 110, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/src/django/core/management/sql.py", line 189, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/src/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/src/django/contrib/contenttypes/management.py", line 67, in update_contenttypes
    ct.delete()
  File "/src/django/db/models/base.py", line 599, in delete
    collector.delete()
  File "/src/django/db/models/deletion.py", line 61, in decorated
    func(self, *args, **kwargs)
  File "/src/django/db/models/deletion.py", line 261, in delete
    query.delete_batch([obj.pk for obj in instances], self.using, field)
  File "/src/django/db/models/sql/subqueries.py", line 44, in delete_batch
    self.do_query(self.model._meta.db_table, where, using=using)
  File "/src/django/db/models/sql/subqueries.py", line 29, in do_query
    self.get_compiler(using).execute_sql(None)
  File "/src/djangotoolbox/db/basecompiler.py", line 593, in execute_sql
    self.build_query([self.query.get_meta().pk]).delete()
  File "/src/djangoappengine/db/compiler.py", line 69, in _func
    return func(*args, **kwargs)
  File "/src/djangoappengine/db/compiler.py", line 168, in delete
    Delete(keys)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 695, in Delete
    return DeleteAsync(keys, **kwargs).get_result()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 674, in DeleteAsync
    keys, _ = NormalizeAndTypeCheckKeys(keys)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 176, in NormalizeAndTypeCheckKeys
    keys, multiple = NormalizeAndTypeCheck(keys, (basestring, Entity, Key))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 143, in NormalizeAndTypeCheck
    arg_list = list(arg)
  File "/src/djangoappengine/db/compiler.py", line 105, in fetch
    query = self._build_query()
  File "/src/djangoappengine/db/compiler.py", line 69, in _func
    return func(*args, **kwargs)
  File "/src/djangoappengine/db/compiler.py", line 322, in _build_query
    return MultiQuery(self.gae_query, self.ordering)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 1998, in __init__
    'MultiQuery does not support keys_only.')
django.db.utils.DatabaseError: MultiQuery does not support keys_only.

我可以通过删除本地开发服务器上的内容类型来解决它,但我想知道为什么我收到此错误。我确实理解了异常所说的内容,但是不明白为什么NonRel没有调整Django来在App Engine中正确执行此操作?

2 个答案:

答案 0 :(得分:0)

这可能是djangoappengine编译器路径中的一个错误,它没有得到太多利用。几个月前还有另一个与删除相关的错误:

https://groups.google.com/forum/#!searchin/django-non-relational/delete/django-non-relational/Eb6K7fVYrhM/_QmLPtbIfmMJ

话虽如此,我甚至不确定为什么djangoappengine在部署时会运行syncdb。它在本地运行syncdb,而不是在生产服务器上运行。这似乎是不必要的,我怀疑它只是一些现有的django代码路径的副产品。

答案 1 :(得分:0)

我试了一下simillar错误

  

./ manage.py sqlflush