'How list all opened connections in sqlalchemy?

Recently I had an error sqlalchemy in my production server.

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "myserver.com" (myip), port myport failed: FATAL: remaining connection slots are reserved for non-replication superuser connections

However this application only has a few users (1 or 2) and it's not possible that the database server is not powerful enough.

My application is 100% tested and I would also like to test the number of opened connections.

Is there a way to list opened connection in sqlalchemy?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source