Skip to content

Commit d15d55a

Browse files
tonalclaude
andcommitted
fix(aiomysql): Use record_sql_queries (renamed back in upstream)
Upstream renamed record_sql_queries_supporting_streaming back to record_sql_queries since it now natively supports streaming. Update imports and mock targets accordingly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c09a123 commit d15d55a

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

sentry_sdk/integrations/aiomysql.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sentry_sdk.tracing_utils import (
1111
add_query_source,
1212
has_span_streaming_enabled,
13-
record_sql_queries_supporting_streaming,
13+
record_sql_queries,
1414
)
1515
from sentry_sdk.utils import (
1616
capture_internal_exceptions,
@@ -85,7 +85,7 @@ async def _inner(*args: Any, **kwargs: Any) -> T:
8585
params_list = params if integration and integration._record_params else None
8686
param_style = "pyformat" if params_list else None
8787

88-
with record_sql_queries_supporting_streaming(
88+
with record_sql_queries(
8989
cursor=None,
9090
query=query_str,
9191
params_list=params_list,
@@ -132,7 +132,7 @@ async def _inner(*args: Any, **kwargs: Any) -> T:
132132
# Prevent double-recording: _do_execute_many calls self.execute internally
133133
cursor._sentry_skip_next_execute = True
134134
try:
135-
with record_sql_queries_supporting_streaming(
135+
with record_sql_queries(
136136
cursor=None,
137137
query=query_str,
138138
params_list=params_list,

tests/integrations/aiomysql/test_aiomysql.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from sentry_sdk import capture_message, start_transaction
2323
from sentry_sdk.consts import SPANDATA
2424
from sentry_sdk.integrations.aiomysql import AioMySQLIntegration
25-
from sentry_sdk.tracing_utils import record_sql_queries_supporting_streaming
25+
from sentry_sdk.tracing_utils import record_sql_queries
2626
from tests.conftest import ApproxDict
2727

2828
MYSQL_HOST = os.getenv("SENTRY_PYTHON_TEST_MYSQL_HOST", "localhost")
@@ -570,15 +570,15 @@ async def test_no_query_source_if_duration_too_short(sentry_init, capture_events
570570

571571
@contextmanager
572572
def fake_record_sql_queries(*args, **kwargs):
573-
with record_sql_queries_supporting_streaming(*args, **kwargs) as span:
573+
with record_sql_queries(*args, **kwargs) as span:
574574
pass
575575
span.start_timestamp = datetime.datetime(2024, 1, 1, microsecond=0)
576576
span.timestamp = datetime.datetime(2024, 1, 1, microsecond=99999)
577577
yield span
578578

579579
async with conn.cursor() as cur:
580580
with mock.patch(
581-
"sentry_sdk.integrations.aiomysql.record_sql_queries_supporting_streaming",
581+
"sentry_sdk.integrations.aiomysql.record_sql_queries",
582582
fake_record_sql_queries,
583583
):
584584
await cur.execute(
@@ -616,15 +616,15 @@ async def test_query_source_if_duration_over_threshold(sentry_init, capture_even
616616

617617
@contextmanager
618618
def fake_record_sql_queries(*args, **kwargs):
619-
with record_sql_queries_supporting_streaming(*args, **kwargs) as span:
619+
with record_sql_queries(*args, **kwargs) as span:
620620
pass
621621
span.start_timestamp = datetime.datetime(2024, 1, 1, microsecond=0)
622622
span.timestamp = datetime.datetime(2024, 1, 1, microsecond=100001)
623623
yield span
624624

625625
async with conn.cursor() as cur:
626626
with mock.patch(
627-
"sentry_sdk.integrations.aiomysql.record_sql_queries_supporting_streaming",
627+
"sentry_sdk.integrations.aiomysql.record_sql_queries",
628628
fake_record_sql_queries,
629629
):
630630
await cur.execute(

0 commit comments

Comments
 (0)