Siva Sakthi Velan
Siva Sakthi Velan

Reputation: 90

Counting Active connections in peewee ORM

I am using Python's peewee ORM with MYSQL. I want to list the active connections for the PooledDatabase. Is there any way to list..?

Upvotes: 1

Views: 471

Answers (1)

coleifer
coleifer

Reputation: 26215

What do you mean "active"? Active as in being "checked out" by a thread, or active as in "has a connection to the database"?

For the first, you would just do pooled_db._in_use.

For the second, it's a little trickier -- basically it will be the combination of pooled_db._in_use (a dict) and pooled_db._connections (a heap).

Upvotes: 2

Related Questions