[Answered ]-Database connection object is not callable exception thrown with Python Django SQL Alchemy database pooling. Why?

1👍

According to the QueuePool docs the first argument should be ‘a callable function that returns a DB-API connection object’.

You’ve passed the result of the called function to the QueuePool object as the first argument instead of the function itself. Remove the parenthesis to solve the issue:

def createPool(self):
    dbConnection = self.dbConnect
    global dbPool
    dbPool = pool.QueuePool(dbConnection, max_overflow=10, pool_size=5)

Leave a comment