Joern Boegeholz
Joern Boegeholz

Reputation: 591

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?

Upvotes: 9

Views: 9919

Answers (2)

Joseph Sheedy
Joseph Sheedy

Reputation: 6726

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
})

Upvotes: 4

Joern Boegeholz
Joern Boegeholz

Reputation: 591

Finally found it: A colleague introduced the config param SQLALCHEMY_POOL_SIZE in the Config Base Class to use it with mySQL.

Nevertheless it would be great if either flask_sqlalchemy or sqlalchemy would ignore the parameter instead of throwing an error.

I've created a ticket for the flask_sqlalchemy project: https://github.com/mitsuhiko/flask-sqlalchemy/issues/426

Upvotes: 7

Related Questions