Skip to content

Fix fetch limit bind parameter type inference - #272

Merged
lesnik512 merged 1 commit into
mainfrom
fix/271-limit-bindparam-typing
Nov 4, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/271-limit-bindparam-typing

Conversation

@lesnik512

Copy link
Copy Markdown
Member

SQLAlchemy 2.1.8 with ty 0.0.97 infers BindParameter[int | property] when the fetch limit uses the Integer class, causing both .limit(limit) calls to fail type checking. Pass Integer() so the parameter is inferred as an integer without changing the query structure.

Closes #271.

Validation:

  • Reproduced both type errors with SQLAlchemy 2.1.8 and ty 0.0.97 before the fix; confirmed the same ty version passes with SQLAlchemy 2.1.6.
  • Type check passes on Python 3.11 with SQLAlchemy 2.1.8 and ty 0.0.97 after the fix.
  • Ruff, formatting, and EOF checks pass.
  • Full suite against PostgreSQL 17: 836 passed, 100% coverage, 9 warnings.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Benchmark gate

✅ gate passed

scenario msg/s delete/msg WALrec/msg WALB/msg fpi upd del dead_tup
consumer/w1/b10 1294 1.000 6.72 921 242 5000 5000 10000
consumer/w1/b100 1410 1.000 7.11 1154 243 5000 5000 10000
consumer/w2/b10 1546 1.000 6.72 923 242 5000 5000 10000
consumer/w2/b100 1735 1.000 7.11 1154 243 5000 5000 10000
consumer/w4/b10 1619 1.000 6.79 986 261 5000 5000 10000
consumer/w4/b100 1897 1.000 7.11 1155 244 5000 5000 10000
consumer/w1/b100/tfbs100 5642 0.010 6.11 1130 243 5000 5000 10000
consumer/w1/b100/interval1-10 1407 1.000 7.11 1154 243 5000 5000 10000
producer/w1/b100 2957 0.000 3.04 597 1 0 0 0
producer/w1/b100/ppt1 967 0.000 4.04 635 0 0 0 0

Gated (fails the build): delete_calls + tuple counters (upd/del/ins) + the producer's insert_calls, exact; select_calls and other_calls within +2; wal_records within a 10% band; fetch_calls within 2x. msg/s, WAL bytes and total calls are informational (timing/FPI noise).

@lesnik512
lesnik512 merged commit 62c08eb into main Nov 4, 2026
15 checks passed
@lesnik512
lesnik512 deleted the fix/271-limit-bindparam-typing branch November 4, 2026 14:30
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.

Scheduled dependency check failed

1 participant