Skip to content

Commit 8103651

Browse files
authored
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.
1 parent 207ac1a commit 8103651

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: src/MySQLdb/connections.py

+2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ class object, used to create cursors (keyword only)
204204
if type(k) is not int # noqa: E721
205205
}
206206

207+
self.database = kwargs2.get("database", "")
208+
207209
self._server_version = tuple(
208210
[numeric_part(n) for n in self.get_server_info().split(".")[:2]]
209211
)

0 commit comments

Comments
 (0)