integ/devtools/python/python-sqlalchemy_0.9.9/sqlalchemy_queue_pool_info.patch
Dean Troyer 3cd12006bb StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:35 -07:00

34 lines
1.1 KiB
Diff

---
lib/sqlalchemy/pool.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/lib/sqlalchemy/pool.py
+++ b/lib/sqlalchemy/pool.py
@@ -435,6 +435,17 @@ class _ConnectionRecord(object):
"""
return {}
+ @property
+ def pool_info(self):
+ """The ``.pool_info`` dictionary associated with the DBAPI connection.
+ """
+ pool_info = dict()
+ pool_info['Pool size'] = self.__pool.size()
+ pool_info['Connections'] = self.__pool.checkedin()
+ pool_info['Overflow'] = self.__pool.overflow()
+ pool_info['Checkedout'] = self.__pool.checkedout()
+ return pool_info
+
@classmethod
def checkout(cls, pool):
rec = pool._do_get()
@@ -540,7 +551,7 @@ class _ConnectionRecord(object):
self.__pool.logger.debug("Created new connection %r", connection)
return connection
except Exception as e:
- self.__pool.logger.debug("Error on connect(): %s", e)
+ self.__pool.logger.error("Error on connect(): %s, %s", self.__pool.status(), e)
raise