Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,15 +695,10 @@ def _set_db_data(span, cursor_or_db):
if is_psycopg2:
connection_params = cursor_or_db.connection.get_dsn_parameters()
else:
is_psycopg3 = (
hasattr(cursor_or_db, "connection")
and hasattr(cursor_or_db.connection, "info")
and hasattr(cursor_or_db.connection.info, "get_parameters")
and inspect.isroutine(cursor_or_db.connection.info.get_parameters)
)
if is_psycopg3:
try:
# psycopg3
connection_params = cursor_or_db.connection.info.get_parameters()
else:
except Exception:
connection_params = db.get_connection_params()

db_name = connection_params.get("dbname") or connection_params.get("database")
Expand Down