paltman-archive / nashvegas

Another database migration script runner for Django projects.
http://paltman.github.com/nashvegas
MIT License
97 stars 18 forks source link

upgradedb --execute failing on SQLite #21

Closed j4mie closed 12 years ago

j4mie commented 13 years ago

Hi,

I'm trying to set up Nashvegas in a project that is still in development, using SQLite.

I started by removing my current database file, and running:

django-admin.py upgradedb --create  > migrations/0001.sql

To get a fresh migration to start with. I then tried running:

django-admin.py upgradedb --execute --path migrations

This gives the following error:

Executing 0001.sql... failed
Traceback (most recent call last):
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/nashvegas/management/commands/upgradedb.py", line 183, in execute_migrations
    cursor.execute(to_execute)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/db/backends/util.py", line 34, in execute
    return self.cursor.execute(sql, params)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 234, in execute
    return Database.Cursor.execute(self, query, params)
Warning: You can only execute one statement at a time.
Rolled back all migrations.
Traceback (most recent call last):
  File "/Users/jamie/.virtualenvs/dabapps/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
    utility.execute()
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/nashvegas/management/commands/upgradedb.py", line 297, in handle
    self.execute_migrations(show_traceback=True)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/django/db/transaction.py", line 217, in inner
    res = func(*args, **kwargs)
  File "/Users/jamie/.virtualenvs/dabapps/lib/python2.6/site-packages/nashvegas/management/commands/upgradedb.py", line 188, in execute_migrations
    raise MigrationError()
nashvegas.management.commands.upgradedb.MigrationError

The error being returned from the database backend seems to be:

    Warning: You can only execute one statement at a time.

I'm not really sure where to start with figuring this out.. Google doesn't seem to be helping much. Any ideas?

Thanks

brosner commented 13 years ago

Looks like nashvegas can't support SQLite as is. Essentially what's happening is we are putting the SQL file through cursor.execute and SQLite Python drivers (either on its own or enforcing something SQLite can't do) is throwing the exception that it isn't possible.

nashvegas has only really been tested on PostgreSQL and has been very successful there. Personally, I've moved to using PostgreSQL for everything. It works much nicer in the end for me.

paltman commented 12 years ago

We have no plans to support SQLite at this time.