Skip to content

Commit ca82cd2

Browse files
Pin supports_server_side_cursors False on the async dialect
dqlite has no server-side cursor notion at the wire protocol level. Pin the flag on DqliteDialect_aio so a future default flip in SQLAlchemy's AsyncDialect cannot silently route the dqlite async engine through an SS-cursor code path the adapter does not implement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1b0743d commit ca82cd2

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/sqlalchemydqlite/aio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ class DqliteDialect_aio(DqliteDialect): # noqa: N801
208208
# warning fires on every engine startup.
209209
supports_statement_cache = True
210210

211+
# dqlite has no server-side cursor notion at the wire level — rows
212+
# arrive in frames that the client fully consumes before surfacing
213+
# them, and the adapter eagerly buffers into a deque. Pin False
214+
# locally so a future base-class default flip (e.g. AsyncDialect
215+
# defaulting True the way aiosqlite does) cannot silently route
216+
# through an SS-cursor code path the adapter does not implement.
217+
supports_server_side_cursors = False
218+
211219
@classmethod
212220
def get_pool_class(cls, url: URL) -> type[pool.Pool]:
213221
return AsyncAdaptedQueuePool

tests/test_dialect.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ def test_insert_path_flags_pinned_locally(self, flag: str) -> None:
104104
assert getattr(DqliteDialect, flag) is True
105105
assert flag in DqliteDialect.__dict__
106106

107+
def test_supports_server_side_cursors_pinned_false_on_aio(self) -> None:
108+
"""dqlite has no server-side cursor notion; pin locally on the
109+
async dialect so an upstream AsyncDialect default flip cannot
110+
silently route through an SS-cursor code path we do not
111+
implement.
112+
"""
113+
from sqlalchemydqlite.aio import DqliteDialect_aio
114+
115+
assert DqliteDialect_aio.supports_server_side_cursors is False
116+
assert "supports_server_side_cursors" in DqliteDialect_aio.__dict__
117+
107118
def test_returns_native_bytes_pinned_locally(self) -> None:
108119
"""dqlitedbapi returns native Python ``bytes`` for BLOB columns;
109120
pin True locally so ``LargeBinary.result_processor`` skips the

0 commit comments

Comments
 (0)