Why am I getting MultiQuery exception on 1.4 nonrel? - google-app-engine

I'm testing an upgrade on NonRel for App Engine to 1.4 from 1.3. It works fine locally, but when I deploy to App Engine, I get a syncdb error in the end of deployment:
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.
I am able to work around it by deleting the content types on my local development server, but I'm wondering why I'm getting this error. I do understand what the exception says, but don't understand why NonRel has not adapted Django to perform this operation properly in App Engine?

This could be a bug in a path of the djangoappengine compiler that isn't utilized much. There was another delete related bug a few months ago:
https://groups.google.com/forum/#!searchin/django-non-relational/delete/django-non-relational/Eb6K7fVYrhM/_QmLPtbIfmMJ
That being said, I'm not even sure why djangoappengine runs syncdb at all when you deploy. It runs syncdb locally, not on the production server. It seems unnecssary, I suspect it's just a byproduct of some existing django codepath.

I encontered a simillar error can you try
./manage.py sqlflush

Related

I created a virtual environmnt for my new projec, instaled django and started the new project. whnvr I run code with manage.py i get this long error

`when i run line of code: python manage.py startapp blog error below displays
Traceback (most recent call last):
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 22, in <module>
main()
File "C:\Users\lenevo\Desktop\portfolio-project\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\djayour textngo\db\utils.py", line 224, in close_all
connection.close()
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
if not self.is_in_memory_db():
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
return self.creation.is_in_memory_db(self.settings_dict['NAME'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lenevo\Desktop\reemaenv\Lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
return database name == ':memory:' or 'mode=memory' in database name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type Error: argument of type 'Windows Path' is not Iterable
plz help me solve this problem `

Resolve the error while using 'yarn db:start' command

I am trying to setup a ReactJS workspace in VSCode for Parabol. While executing the command yarn db:start, I am receiving the below exception.
yarn run v1.22.11
$ docker-compose -f docker/dev.yml up -d
Traceback (most recent call last):
File "docker\api\client.py", line 214, in _retrieve_server_version
File "docker\api\daemon.py", line 181, in version
File "docker\utils\decorators.py", line 46, in inner
File "docker\api\client.py", line 237, in _get
File "requests\sessions.py", line 543, in get
File "requests\sessions.py", line 530, in request
File "requests\sessions.py", line 643, in send
File "requests\adapters.py", line 439, in send
File "urllib3\connectionpool.py", line 670, in urlopen
File "urllib3\connectionpool.py", line 392, in _make_request
File "http\client.py", line 1255, in request
File "http\client.py", line 1301, in _send_request
File "http\client.py", line 1250, in endheaders
File "http\client.py", line 1010, in _send_output
File "http\client.py", line 950, in send
File "docker\transport\npipeconn.py", line 32, in connect
File "docker\transport\npipesocket.py", line 23, in wrapped
File "docker\transport\npipesocket.py", line 72, in connect
File "docker\transport\npipesocket.py", line 52, in connect
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')
I am pretty new to ReactJS and have little to no idea on what to do to setup this workspace. Would be much grateful for any help.
Bruce here from Parabol. Thanks for your interest in our app!
For the issue you have seen, can you check:
You have Docker up and running
You run yarn db:start from the root of the repository
Feel free to create an issue in our repo and we will be more than happy to help you!

django call_command syncdb failed: unable to open database file

I want to add some python codes after syncdb, so I decide to write a build.py which does everything including syncdb.
I write something in build.py as:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import call_command
from django.contrib.auth.models import User
call_command('syncdb', interactive=False)
But when I run build.py, it said:
Traceback (most recent call last):
File "/home/csimstu/PycharmProjects/TeenHope/TeenHope/build.py", line 5, in <module>
call_command('syncdb', interactive=False)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 161, in call_command
return klass.execute(*args, **defaults)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 255, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 56, in handle_noargs
cursor = connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 324, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 306, in _cursor
self._sqlite_create_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 296, in _sqlite_create_connection
self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file
I've tried ./manage.py syncdb and use call_command in interactive shell mode, and both ways worked perfectly okay. How could it be?
If the database file isn't found that's probably because you didn't use a full path in your settings.
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.realpath(os.path.join(os.path.dirname(__file__), "relative_path_here", "database.db")),
Out of topic: I'd recommend to use Fabric for this kind of commands.

South migration schemamigration doesn't work

Just to make sure I have the setup right in my current django project, I did the following:
added south to installed_apps
manage.py syncdb (using windows)
manage.py convert_to_south app
I didn't make changes to my database yet but whether or not I do, I run:
manage.py schemamigration app --auto
and I get the following errors:
Traceback (most recent call last):
File "manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 443, in execute
_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196, in run_from_ar
gv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\south\management\commands\schemamigration.py", line 98, i
n handle
old_orm = last_migration.orm(),
File "C:\Python27\lib\site-packages\south\utils.py", line 62, in method
value = function(self)
File "C:\Python27\lib\site-packages\south\migration\base.py", line 418, in orm
return FakeORM(self.migration_class(), self.app_label())
File "C:\Python27\lib\site-packages\south\orm.py", line 46, in FakeORM
_orm_cache[args] = _FakeORM(*args)
File "C:\Python27\lib\site-packages\south\orm.py", line 125, in __init__
self.models[name] = self.make_model(app_label, model_name, data)
File "C:\Python27\lib\site-packages\south\orm.py", line 318, in make_model
field = self.eval_in_context(code, app, extra_imports)
File "C:\Python27\lib\site-packages\south\orm.py", line 236, in eval_in_context
return eval(code, globals(), fake_locals)
File "<string>", line 1
SouthFieldClass(default=datetime.datetime(2012, 9, 14, 20, 46, 3, 957000, tzinfo=<UTC>))
^
SyntaxError: invalid syntax
What's going on?
It's not letting me use schemamigration. Been searching a lot of places and deleting and resetting the database and everything, can't seem to find out what the problem is.
Problem resolved:
Didn't know about south_migrationhistory location. I was always wondering about where some extra information was hanging.
Have a look here: http://south.aeracode.org/ticket/1069
Its a bug that is fixed in newer South versions. It seems you are using an obsolete version of South(<=0.7.3)

How do I add a new model and generate the migrations with South 0.7.2?

I created a new model:
class RssFeed(models.Model):
url = mdels.CharField(max_length=300)
$ python manage.py schemamigration forum --add-model RssFeed
Traceback (most recent call last):
File "manage.py", line 13, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/site-packages/Django-1.2.3-py2.7.egg/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/site-packages/Django-1.2.3-py2.7.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/Django-1.2.3-py2.7.egg/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/site-packages/Django-1.2.3-py2.7.egg/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/South-0.7.2-py2.7.egg/south/management/commands/schemamigration.py", line 134, in handle
for action_name, params in change_source.get_changes():
File "/usr/local/lib/python2.7/site-packages/South-0.7.2-py2.7.egg/south/creator/changes.py", line 397, in get_changes
real_fields, meta, m2m_fields = self.split_model_def(model, model_defs[model_key(model)])
File "/usr/local/lib/python2.7/site-packages/South-0.7.2-py2.7.egg/south/creator/freezer.py", line 58, in model_key
return "%s.%s" % (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
My syntax was correct, the way I had created the model wasn't.
I had placed all my models into a directory /models
If you do this, you must add Meta to your model definition:
class Meta:
app_label = 'APP_NAME'
If you don't do this, Django can't discover the new models.

Resources