naren
naren

Reputation: 15233

How to increase poolsize in sqlalchemy

Getting TimeoutError in sqlalchemy when using with pyramid

TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30

extension = ZopeTransactionExtension()
session = sessionmaker(extension=extension, expire_on_commit=False)
DBSession = scoped_session(session)
Base = declarative_base()

I am using the above connection procedure to run few cronjobs, some times i hit timeout error. I am closing the session after completion of task.

The other way to get rid of above error is increasing pool_size, but how to do in pyramid.

Upvotes: 1

Views: 2181

Answers (1)

naren
naren

Reputation: 15233

Found it. After looking at the code https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/init.py#L376

sqlalchemy.url = postgresql://postgres:password@localhost/your_db
sqlalchemy.pool_size = 10
sqlalchemy.max_overflow = 15

Upvotes: 1

Related Questions