Skip to content

Commit 76823cb

Browse files
docs: warn that fetchone() materializes the entire result set
dqlite returns all matching rows in one response (no server-side cursors). fetchone() delegates to fetch() which reads all rows into memory. Add a docstring note advising users to add LIMIT 1 for large result sets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4c39fd2 commit 76823cb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/dqliteclient/connection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,12 @@ async def fetchall(self, sql: str, params: Sequence[Any] | None = None) -> list[
274274
async def fetchone(
275275
self, sql: str, params: Sequence[Any] | None = None
276276
) -> dict[str, Any] | None:
277-
"""Execute a query and return the first result."""
277+
"""Execute a query and return the first result.
278+
279+
Note: dqlite returns all matching rows over the wire. For large
280+
result sets, add ``LIMIT 1`` to your query to avoid excessive
281+
memory usage.
282+
"""
278283
results = await self.fetch(sql, params)
279284
return results[0] if results else None
280285

0 commit comments

Comments
 (0)