Skip to content

fix(#650): bind UUID parameters for PostgreSQL ADBC#651

Merged
cofin merged 6 commits into
mainfrom
fix/650-adbc-uuid
Jul 22, 2026
Merged

fix(#650): bind UUID parameters for PostgreSQL ADBC#651
cofin merged 6 commits into
mainfrom
fix/650-adbc-uuid

Conversation

@cofin

@cofin cofin commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

  • bind top-level UUID parameters safely for PostgreSQL-family ADBC drivers by adding explicit UUID casts per execution
  • keep value-sensitive SQL out of statement caches while caching only the deterministic SQLGlot rewrite
  • validate UUID batches, preserve authoritative explicit casts, and leave nested and non-PostgreSQL values unchanged
  • use the registered pgvector and paradedb dialects so their custom operators survive the rewrite
  • place the deterministic preparation helper in compiled adbc/core.py and keep the driver integration point small

Fixes #650.

Testing

  • ADBC unit, PostgreSQL live, cache-order, batch, streaming, and Arrow-path tests: passed
  • UUID and dialect-focused interpreted suite: passed
  • make install-compiled: passed (178 compiled modules)
  • compiled mypyc inventory and UUID behavior smoke tests: passed
  • make lint: passed, including mypy, pyright, pre-commit, and slotscheck
  • final local live rerun was blocked at fixture setup by a stale pytest-databases PostgreSQL container with no port mapping; the same live tests passed before the Docker service degraded

Documentation

  • added a v0.56.0 changelog entry

@codecov-commenter

codecov-commenter commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.09009% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.09%. Comparing base (cfc05e8) to head (a032c9d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sqlspec/adapters/adbc/core.py 89.81% 7 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #651      +/-   ##
==========================================
+ Coverage   77.06%   77.09%   +0.02%     
==========================================
  Files         475      475              
  Lines       67206    67363     +157     
  Branches    10073     9209     -864     
==========================================
+ Hits        51794    51935     +141     
- Misses      12017    12030      +13     
- Partials     3395     3398       +3     
Flag Coverage Δ
integration 60.69% <63.06%> (+0.01%) ⬆️
py3.10 75.39% <90.09%> (+0.05%) ⬆️
py3.11 75.41% <90.09%> (+0.05%) ⬆️
py3.12 75.41% <90.09%> (+0.05%) ⬆️
py3.13 75.41% <90.09%> (+0.04%) ⬆️
py3.14 76.30% <90.09%> (+0.05%) ⬆️
unit 64.54% <90.09%> (+0.12%) ⬆️

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

Files with missing lines Coverage Δ
sqlspec/adapters/adbc/driver.py 79.02% <100.00%> (+0.18%) ⬆️
sqlspec/adapters/adbc/core.py 81.85% <89.81%> (+2.39%) ⬆️

... and 2 files with indirect coverage changes

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

Signed-off-by: Cody Fincher <204685+cofin@users.noreply.github.com>
@cofin
cofin marked this pull request as ready for review July 22, 2026 16:21
cofin added 4 commits July 22, 2026 16:36
Return the compiled SQL and parameters untouched when every requested
ordinal already carries an authoritative non-UUID cast, so SQL text only
changes when a cast is actually added and batch rows are never copied
for a no-op rewrite.

Treat unrecognized execute_many row shapes as non-UUID batches instead
of raising; shape validation stays with the statement pipeline, which
already rejects ragged batches before the rewrite runs.

Normalize the postgresql dialect alias before the memoized rewrite so
both spellings share one cache entry, and document that the helper is
memoized per statement shape: the deliberate second parse of compiled
SQL happens once per (sql, ordinals, dialect) and repeated executions
reuse the cached rewrite.

Quote the remaining union annotations and mark the UUID type tuple
Final to match module conventions.

Refs #650.
@cofin
cofin merged commit 3759181 into main Jul 22, 2026
20 checks passed
@cofin
cofin deleted the fix/650-adbc-uuid branch July 22, 2026 20:32
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 (PostgreSQL): uuid.UUID parameters bind as bytea — operator does not exist: uuid = bytea

2 participants