我正在使用 Elixir 0.7.1、Sqlalchemy 0.6beta1、MySQLdb 1.2.2。我的模型文件“model.py”如下所示:
from elixir import *
from datetime import datetime
class Author:
first_name = Field(Unicode(64))
last_name = Field(Unicode(64))
class Article:
title = Field(Unicode(64))
class Category:
name = Field(Unicode(64))
setup_all()
metadata.bind = "mysql://user:pass@localhost/dbname"
metadata.bind.echo = True
create_all()
metadata.create_all()
执行后: python model.py ,没有创建表,也没有抛出错误。以下是发送到 SQL 服务器的 echo 的命令列表:
2010-03-06 19:50:22,004 INFO sqlalchemy.engine.base.Engine.0x...6c4c SELECT DATABASE()
2010-03-06 19:50:22,004 INFO sqlalchemy.engine.base.Engine.0x...6c4c ()
2010-03-06 19:50:22,005 INFO sqlalchemy.engine.base.Engine.0x...6c4c SHOW VARIABLES LIKE 'character_set%%'
2010-03-06 19:50:22,005 INFO sqlalchemy.engine.base.Engine.0x...6c4c ()
2010-03-06 19:50:22,006 INFO sqlalchemy.engine.base.Engine.0x...6c4c SHOW VARIABLES LIKE 'lower_case_table_names'
2010-03-06 19:50:22,006 INFO sqlalchemy.engine.base.Engine.0x...6c4c ()
2010-03-06 19:50:22,007 INFO sqlalchemy.engine.base.Engine.0x...6c4c SHOW COLLATION
2010-03-06 19:50:22,007 INFO sqlalchemy.engine.base.Engine.0x...6c4c ()
2010-03-06 19:50:22,009 INFO sqlalchemy.engine.base.Engine.0x...6c4c SHOW VARIABLES LIKE 'sql_mode'
2010-03-06 19:50:22,010 INFO sqlalchemy.engine.base.Engine.0x...6c4c ()
我已经搜索了解决方案,但找不到任何解决方案。