Skip to content

Look at the Dialect for SQLAlchemy, and small cleanup

78009c0
Select commit
Loading
Failed to load commit list.
Merged

feat: Add db.driver.name spans to database integrations #6082

Look at the Dialect for SQLAlchemy, and small cleanup
78009c0
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Apr 15, 2026 in 1m 57s

1 issue

code-review: Found 1 issue (1 high)

High

Test assertion will fail: DB_DRIVER_NAME not set for parameter-less execute calls - `tests/integrations/asyncpg/test_asyncpg.py:557`

The new assertion assert data.get(SPANDATA.DB_DRIVER_NAME) == "asyncpg" will fail because _wrap_execute does not call _set_db_data() when len(args) <= 2. The test calls conn.execute("INSERT INTO ...") with only a query string (no parameters), so it goes through the code path at lines 76-88 in asyncpg.py which uses record_sql_queries but never sets DB_DRIVER_NAME. The span will be missing this attribute, causing the test to fail.


Duration: 1m 57s · Tokens: 1.2M in / 15.6k out · Cost: $2.82

Annotations

Check failure on line 557 in tests/integrations/asyncpg/test_asyncpg.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: code-review

Test assertion will fail: DB_DRIVER_NAME not set for parameter-less execute calls

The new assertion `assert data.get(SPANDATA.DB_DRIVER_NAME) == "asyncpg"` will fail because `_wrap_execute` does not call `_set_db_data()` when `len(args) <= 2`. The test calls `conn.execute("INSERT INTO ...")` with only a query string (no parameters), so it goes through the code path at lines 76-88 in asyncpg.py which uses `record_sql_queries` but never sets `DB_DRIVER_NAME`. The span will be missing this attribute, causing the test to fail.