aishee / sqlalchemy-migrate

Automatically exported from code.google.com/p/sqlalchemy-migrate
MIT License
0 stars 0 forks source link

Column dropping doesn't quote column names (sqlite) #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write a migration script for a table that has a column called 'order'
2. Create an sqlite database
3. Try to drop any other column of that table

What is the expected output? What do you see instead?

Downgrading...
Traceback (most recent call last):
  File "bin/manage", line 34, in <module>
    bookserv.model.schema.manage.main()
  File "/home/mg/src/bookserv/src/bookserv/model/schema/manage.py", line
30, in main
    shell.main(repository=here, **kw)
  File
"/home/mg/tmp/buildout-eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versionin
g/shell.py",
line 150, in main
    ret = command_func(**kwargs)
  File
"/home/mg/tmp/buildout-eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versionin
g/api.py",
line 136, in test
    script.run(engine, -1)
  File
"/home/mg/tmp/buildout-eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versionin
g/script/py.py",
line 101, in run
    func()
  File
"/home/mg/src/bookserv/src/bookserv/model/schema/versions/001_publisher_info.py"
,
line 83, in downgrade
    Book.__table__.columns[col].drop()
  File
"/home/mg/tmp/buildout-eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/changeset
/schema.py",
line 384, in drop
    self, *args, **kwargs)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 1158, in _run_visitor
    visitorcallable(self.dialect, conn, **kwargs).traverse(element)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/sql/visitors.p
y",
line 89, in traverse
    return traverse(obj, self.__traverse_options__, self._visitor_dict)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/sql/visitors.p
y",
line 200, in traverse
    return traverse_using(iterate(obj, opts), obj, visitors)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/sql/visitors.p
y",
line 194, in traverse_using
    meth(target)
  File
"/home/mg/tmp/buildout-eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/changeset
/databases/sqlite.py",
line 30, in visit_column
    self.execute()
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 1812, in execute
    return self.connection.execute(self.buffer.getvalue())
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 824, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 888, in _execute_text
    return self.__execute_context(context)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 896, in __execute_context
    self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 950, in _cursor_execute
    self._handle_dbapi_exception(e, statement, parameters, cursor, context)
  File
"/home/mg/tmp/buildout-eggs/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/engine/base.py
",
line 931, in _handle_dbapi_exception
    raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
sqlalchemy.exc.OperationalError: (OperationalError) near "order": syntax
error 'INSERT INTO books SELECT
id,title,author_id,series_id,order,asin,small_image_id,medium_image_id,large_ima
ge_id,publication_date,isbn,date_added
from migration_tmp' ()

What version of the product are you using? On what operating system?

sqlalchemy-migrate 0.5.4 on Ubuntu 9.04

Please provide any additional information below.

Original issue reported on code.google.com by mged...@gmail.com on 21 Sep 2009 at 7:23

GoogleCodeExporter commented 9 years ago
This should also be fixed in trunk, please always test with trunk.

Original comment by iElect...@gmail.com on 21 Sep 2009 at 10:20