Skip to content

fix: Fix deprecation warning in sqlalchemy integration #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2020
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
5 changes: 3 additions & 2 deletions sentry_sdk/integrations/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setup_once():

listen(Engine, "before_cursor_execute", _before_cursor_execute)
listen(Engine, "after_cursor_execute", _after_cursor_execute)
listen(Engine, "dbapi_error", _dbapi_error)
listen(Engine, "handle_error", _handle_error)


def _before_cursor_execute(
Expand Down Expand Up @@ -63,8 +63,9 @@ def _after_cursor_execute(conn, cursor, statement, *args):
ctx_mgr.__exit__(None, None, None)


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

if span is not None:
Expand Down