Skip to content

Commit ff969c9

Browse files
authored
fix: Fix deprecation warning in sqlalchemy integration (getsentry#612)
Fix getsentry#611
1 parent 0dac166 commit ff969c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sentry_sdk/integrations/sqlalchemy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def setup_once():
2525

2626
listen(Engine, "before_cursor_execute", _before_cursor_execute)
2727
listen(Engine, "after_cursor_execute", _after_cursor_execute)
28-
listen(Engine, "dbapi_error", _dbapi_error)
28+
listen(Engine, "handle_error", _handle_error)
2929

3030

3131
def _before_cursor_execute(
@@ -63,8 +63,9 @@ def _after_cursor_execute(conn, cursor, statement, *args):
6363
ctx_mgr.__exit__(None, None, None)
6464

6565

66-
def _dbapi_error(conn, *args):
66+
def _handle_error(context, *args):
6767
# type: (Any, *Any) -> None
68+
conn = context.connection
6869
span = getattr(conn, "_sentry_sql_span", None) # type: Optional[Span]
6970

7071
if span is not None:

0 commit comments

Comments
 (0)