I did a new pip install of SQLAlchemy and MySQL-Python today, and database creation failed with the following exception (including the echo=True log as well). It appears that MySQL-Python was updated to 1.2.4b1 literally today (see:
). This looks related to the following old thread, where upgrading from 1.2.1 to 1.2.3 introduced a similar error. I downgraded to 1.2.3 (pip install MySQL-Python==1.2.3) and the problem went away. I'm assuming this is a bug in MySQL-Python, and not in SQLAlchemy, but I'm just reporting it here in case others run into this issue. I'm going to report this as a bug in MySQL-Python as well, if I can figure out where I should do that ...
2012-09-26 13:41:48,217 INFO sqlalchemy.engine.base.Engine SELECT DATABASE()
[I 120926 13:41:48 log:107] SELECT DATABASE()
2012-09-26 13:41:48,218 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,219 INFO sqlalchemy.engine.base.Engine SHOW VARIABLES LIKE 'character_set%%'
[I 120926 13:41:48 log:107] SHOW VARIABLES LIKE 'character_set%%'
2012-09-26 13:41:48,219 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,220 INFO sqlalchemy.engine.base.Engine SHOW VARIABLES LIKE 'lower_case_table_names'
[I 120926 13:41:48 log:107] SHOW VARIABLES LIKE 'lower_case_table_names'
2012-09-26 13:41:48,220 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,221 INFO sqlalchemy.engine.base.Engine SHOW COLLATION
[I 120926 13:41:48 log:107] SHOW COLLATION
2012-09-26 13:41:48,221 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,224 INFO sqlalchemy.engine.base.Engine SHOW VARIABLES LIKE 'sql_mode'
[I 120926 13:41:48 log:107] SHOW VARIABLES LIKE 'sql_mode'
2012-09-26 13:41:48,224 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,226 INFO sqlalchemy.engine.base.Engine DESCRIBE "newaccounttoken"
[I 120926 13:41:48 log:107] DESCRIBE "newaccounttoken"
2012-09-26 13:41:48,226 INFO sqlalchemy.engine.base.Engine ()
[I 120926 13:41:48 log:107] ()
2012-09-26 13:41:48,229 INFO sqlalchemy.engine.base.Engine ROLLBACK
[I 120926 13:41:48 log:107] ROLLBACK
Traceback (most recent call last):
File "configuration/mysql/makedb.py", line 93, in <module>
main()
File "configuration/mysql/makedb.py", line 82, in main
server.models.createDB()
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/server/models.py", line 534, in createDB
Base.metadata.create_all(server.db.get_engine())
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/schema.py", line 2564, in create_all
tables=tables)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2303, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1973, in _run_visitor
**kwargs).traverse_single(element)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 106, in traverse_single
return meth(obj, **kw)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/ddl.py", line 54, in visit_metadata
if self._can_create_table(t)]
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/ddl.py", line 32, in _can_create_table
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/base.py", line 1986, in has_table
rs = connection.execute(st)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1449, in execute
params)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1628, in _execute_text
statement, parameters
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1698, in _execute_context
context)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1691, in _execute_context
context)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 331, in do_execute
cursor.execute(statement, parameters)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 181, in execute
self.errorhandler(self, exc, value)
File "/Users/ej/unnamed/build/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass(errorvalue)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1146, "Table 'lectorius.newaccounttoken' doesn't exist") 'DESCRIBE "newaccounttoken"' ()