Skip to content

fix(#687): distinguish operation cancellation from query timeouts - #689

Open
cofin wants to merge 4 commits into
mainfrom
fix/adbc-error-trap
Open

fix(#687): distinguish operation cancellation from query timeouts#689
cofin wants to merge 4 commits into
mainfrom
fix/adbc-error-trap

Conversation

@cofin

@cofin cofin commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • add OperationCancelledError as a sibling of QueryTimeoutError
  • distinguish native cancellation from timeout and deadline signals across ADBC, DuckDB, SQLite, PostgreSQL, Oracle, BigQuery, and Spanner adapters
  • treat bare PostgreSQL SQLSTATE 57014 as OperationalError unless native status or message evidence identifies the cause
  • document the compatibility change and migration path

Root cause

The shared exception contract grouped explicit caller or operator cancellation with elapsed query timeouts. That lost native distinctions such as ADBC CANCELLED versus TIMEOUT and caused callers catching QueryTimeoutError to receive user-initiated cancellation as though a deadline had elapsed.

The shared message classifier now checks timeout markers first because server messages such as canceling statement due to statement timeout contain both cancellation and timeout language.

Closes #687

@codecov-commenter

codecov-commenter commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.18919% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.41%. Comparing base (0adde96) to head (c5d0088).

Files with missing lines Patch % Lines
sqlspec/adapters/adbc/core.py 77.77% 4 Missing and 2 partials ⚠️
sqlspec/adapters/adbc/type_converter.py 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #689      +/-   ##
==========================================
+ Coverage   77.38%   77.41%   +0.03%     
==========================================
  Files         476      476              
  Lines       68211    68266      +55     
  Branches     9385     9403      +18     
==========================================
+ Hits        52782    52846      +64     
+ Misses      12022    12015       -7     
+ Partials     3407     3405       -2     
Flag Coverage Δ
integration 60.87% <33.78%> (-0.04%) ⬇️
py3.10 75.72% <85.13%> (+0.02%) ⬆️
py3.11 64.74% <82.43%> (-10.97%) ⬇️
py3.12 75.73% <85.13%> (+0.02%) ⬆️
py3.13 75.74% <85.13%> (+0.03%) ⬆️
py3.14 76.61% <85.13%> (+0.03%) ⬆️
unit 65.04% <82.43%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/adapters/aiomysql/data_dictionary.py 53.10% <ø> (ø)
sqlspec/adapters/aiosqlite/core.py 80.85% <100.00%> (ø)
sqlspec/adapters/asyncmy/data_dictionary.py 53.10% <ø> (ø)
sqlspec/adapters/asyncpg/core.py 78.18% <100.00%> (+0.55%) ⬆️
sqlspec/adapters/asyncpg/data_dictionary.py 70.25% <ø> (ø)
sqlspec/adapters/bigquery/core.py 73.12% <100.00%> (+1.00%) ⬆️
sqlspec/adapters/bigquery/data_dictionary.py 54.66% <ø> (ø)
...spec/adapters/cockroach_asyncpg/data_dictionary.py 42.02% <ø> (ø)
...spec/adapters/cockroach_psycopg/data_dictionary.py 37.19% <ø> (ø)
sqlspec/adapters/duckdb/core.py 88.08% <100.00%> (+1.03%) ⬆️
... and 22 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin
cofin force-pushed the fix/adbc-error-trap branch from 8a07382 to 896923b Compare August 8, 2026 18:16
@cofin
cofin force-pushed the fix/adbc-error-trap branch from 896923b to c5d0088 Compare August 8, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADBC: statement interrupt/cancel is surfaced as QueryTimeoutError

2 participants