Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions elasticapm/instrumentation/packages/mysql_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ def extract_signature(self, sql):

@property
def _self_database(self) -> str:
# for unknown reasons, the connection is available as the `_connection` attribute on Python 3.6,
# and as `_cnx` on later Python versions
connection = getattr(self, "_cnx") or getattr(self, "_connection")
# it looks like the connection is available as the `_connection` or as `_cnx` depending on Python versions
connection = getattr(self, "_connection", None) or getattr(self, "_cnx", None)
return connection.database if connection else ""


Expand Down
3 changes: 0 additions & 3 deletions tests/instrumentation/mysql_connector_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ def mysql_connector_connection(request):
cursor.execute("DROP TABLE `test`")


@pytest.mark.skipif(
sys.version_info >= (3, 12), reason="Perhaps related to changes in weakref in py3.12?"
) # TODO py3.12
@pytest.mark.integrationtest
def test_mysql_connector_select(instrument, mysql_connector_connection, elasticapm_client):
cursor = mysql_connector_connection.cursor()
Expand Down
Loading