这段代码
create_engine(sqlite:////infodb/timestamp.db', pool_size=10)
在SQLAlchemy 0.6.3版本中运行正常,但在0.7.1版本中不能使用。
我收到的错误信息如下:
TypeError: Invalid argument(s) 'pool_size' sent to create_engine(), using configuration SQLiteDialect_pysqlite/NullPool/Engine. Please check that the keyword arguments are appropriate for this combination of components.
在0.7.1版本中,poolclass
变量的默认值是sqlalchemy.pool.NullPool
的一个实例。而NullPool
对象不接受pool_size
变量。在0.6.3版本中,poolclass
是sqlalchemy.pool.SingletonThreadPool
的一个实例,因此没有处理pool_size
时的问题。
因此,SQLAlchemy 0.7.1版本与0.6.3版本不兼容。我想知道为什么要从SingletonThreadPool
转换到NullPool
?它会破坏用户的代码。