Sql Alchemy connection time Out

Nazmul Hasan picture Nazmul Hasan · Jul 29, 2010 · Viewed 27.2k times · Source

I am using sqlalchemy with MySQL, and executing query with sql expression. When executing a number of query then it time out. I found an answer but it is not clear to me. Please, any one can help me?

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

Answer

Greg picture Greg · Jul 29, 2010

Whenever you create a new session in your code, make sure you close it. Just call session.close()

When I got this error I thought I was closing all of my sessions, but I looked carefully and there was one new method where I wasn't. Closing the session in that method fixed this error for me.