mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2026-03-13 08:00:02 +08:00
add database name as the Connection attribute (#752)
This change adds `self.database` as the Connection attribute displaying the database name from connection parameters. This is very useful for otel dbapi tracer.
This commit is contained in:
@@ -204,6 +204,8 @@ class Connection(_mysql.connection):
|
||||
if type(k) is not int # noqa: E721
|
||||
}
|
||||
|
||||
self.database = kwargs2.get("database", "")
|
||||
|
||||
self._server_version = tuple(
|
||||
[numeric_part(n) for n in self.get_server_info().split(".")[:2]]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user