Following what we commented in How to close sqlalchemy connection in MySQL, I am checking the connections that SQLAlchemy creates into my database and I cannot manage to clo
session.close()
will give the connection back to the connection pool of Engine and doesn't close the connection.
engine.dispose()
will close all connections of the connection pool.
Engine will not use connection pool if you set poolclass=NullPool
. So the connection (SQLAlchemy session) will close directly after session.close()
.