计算 peewee ORM 中的活动连接数
Counting Active connections in peewee ORM
我将 Python 的 peewee ORM 与 MYSQL 一起使用。我想列出 PooledDatabase 的活动连接。有没有办法列出..?
你是什么意思"active"?被线程 "checked out" 激活,或 "has a connection to the database"?
激活
首先,您只需执行 pooled_db._in_use
。
对于第二个,它有点棘手——基本上它将是 pooled_db._in_use
(字典)和 pooled_db._connections
(堆)的组合。
我将 Python 的 peewee ORM 与 MYSQL 一起使用。我想列出 PooledDatabase 的活动连接。有没有办法列出..?
你是什么意思"active"?被线程 "checked out" 激活,或 "has a connection to the database"?
激活首先,您只需执行 pooled_db._in_use
。
对于第二个,它有点棘手——基本上它将是 pooled_db._in_use
(字典)和 pooled_db._connections
(堆)的组合。