Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Invalid argument(s) 'pool_size' sent to create_engine() when using flask_sqlalchemy

I'm using SQLAlchemy==1.0.9 and Flask-SQLAlchemy==2.1 in my Flask application and want to connect to a sqlite db.

I get the error

TypeError: Invalid argument(s) 'pool_size' sent to create_engine(), using configuration SQLiteDialect_pysqlite/NullPool/Engine.

because flask_sqlalchemy always tries to create the engine with the pool_size parameter.

As far as I understand the parameter pool_size is not allowed as an argument for the DefaultEngineStrategy in SQLAlchemy.

Does anyone know a workaround for this issue?

like image 271
Joern Boegeholz Avatar asked Sep 05 '16 13:09

Joern Boegeholz


1 Answers

I fixed this in my Flask/SQLALchemy/SQLite unit tests by adding two Flask configuration parameters:

app.config.update({
    'SQLALCHEMY_POOL_SIZE': None,
    'SQLALCHEMY_POOL_TIMEOUT': None
})
like image 194
Joseph Sheedy Avatar answered Nov 04 '22 04:11

Joseph Sheedy