-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I'm stabbing in the dark here but I can't get a seemingly simple mysql set to work at all with nashvegas. It gets tangled in transaction juggling.
I have
migrations/000_initial_schema.sql
migrations/001_some_alter_table.sql
And this doesn't work. There are no BEGIN or COMMIT or anything like that in any of the .sql
files. As output I get this:
Exception _mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query') in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x102554ad0>> ignored
Executing 0001_webby-stage-auth_bug653180.sql...
So, I thought perhaps it's not right that the cursor is re-created in each iteration of the loop so I moved it outside and tried again. Now I get this:
Rolled back all migrations.
Traceback (most recent call last):
File "./manage.py", line 41, in <module>
execute_manager(settings)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/private/tmp/elmos/1/elmo/vendor-local/lib/python/nashvegas/management/commands/upgradedb.py", line 309, in handle
self.execute_migrations(show_traceback=True)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/transaction.py", line 217, in inner
res = func(*args, **kwargs)
File "/private/tmp/elmos/1/elmo/vendor-local/lib/python/nashvegas/management/commands/upgradedb.py", line 184, in execute_migrations
cursor.execute(to_execute)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/Users/peterbe/virtualenvs/elmo/lib/python2.6/site-packages/MySQLdb/cursors.py", line 154, in execute
charset = db.character_set_name()
django.db.utils.DatabaseError: (2014, "Commands out of sync; you can't run this command now")
Exception _mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query') in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x102540ad0>> ignored
One last time, I removed all my debugging modifications from upgradedb.py and moved away all files (migrations/*.sql) except the one called 000_initial_schema.sql and then I get this error:
Executing 0000_initial_schema.sql... Rolled back all migrations.
Traceback (most recent call last):
File "./manage.py", line 41, in <module>
execute_manager(settings)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/private/tmp/elmos/1/elmo/vendor-local/lib/python/nashvegas/management/commands/upgradedb.py", line 300, in handle
self.execute_migrations(show_traceback=True)
File "/private/tmp/elmos/1/elmo/vendor-local/lib/python/nashvegas/management/commands/upgradedb.py", line 192, in execute_migrations
transaction.commit(using=self.db)
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/transaction.py", line 142, in commit
connection.commit()
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/backends/__init__.py", line 201, in commit
self._commit()
File "/private/tmp/elmos/1/elmo/vendor/src/django/django/db/backends/__init__.py", line 46, in _commit
return self.connection.commit()
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x102554990>> ignored
I should add; my file (000_initial_schema.sql) is pretty big and it creates indexes and a bunch of other things.
Metadata
Metadata
Assignees
Labels
No labels