File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,17 @@ def __init__(
1717 * ,
1818 database : str = "default" ,
1919 timeout : float = 10.0 ,
20+ max_total_rows : int | None = 10_000_000 ,
2021 ) -> None :
2122 """Initialize connection (does not connect yet).
2223
2324 Args:
2425 address: Node address in "host:port" format
2526 database: Database name to open
2627 timeout: Connection timeout in seconds (positive, finite)
28+ max_total_rows: Cumulative row cap across continuation
29+ frames. Forwarded to the underlying DqliteConnection;
30+ ``None`` disables the cap.
2731 """
2832 import math
2933
@@ -32,6 +36,7 @@ def __init__(
3236 self ._address = address
3337 self ._database = database
3438 self ._timeout = timeout
39+ self ._max_total_rows = max_total_rows
3540 self ._async_conn : DqliteConnection | None = None
3641 self ._closed = False
3742 # asyncio primitives MUST be created inside the loop they will
@@ -68,6 +73,7 @@ async def _ensure_connection(self) -> DqliteConnection:
6873 self ._address ,
6974 database = self ._database ,
7075 timeout = self ._timeout ,
76+ max_total_rows = self ._max_total_rows ,
7177 )
7278 try :
7379 await conn .connect ()
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ def __init__(
6464 * ,
6565 database : str = "default" ,
6666 timeout : float = 10.0 ,
67+ max_total_rows : int | None = 10_000_000 ,
6768 ) -> None :
6869 """Initialize connection (does not connect yet).
6970
@@ -74,6 +75,9 @@ def __init__(
7475 and finite; validated here so direct ``Connection(...)``
7576 calls don't silently accept bad values that later
7677 produce hangs or stranger downstream errors)
78+ max_total_rows: Cumulative row cap across continuation
79+ frames for a single query. Forwarded to the underlying
80+ :class:`DqliteConnection`. ``None`` disables the cap.
7781 """
7882 import math
7983
@@ -82,6 +86,7 @@ def __init__(
8286 self ._address = address
8387 self ._database = database
8488 self ._timeout = timeout
89+ self ._max_total_rows = max_total_rows
8590 self ._async_conn : DqliteConnection | None = None
8691 self ._closed = False
8792 self ._loop : asyncio .AbstractEventLoop | None = None
@@ -193,6 +198,7 @@ async def _get_async_connection(self) -> DqliteConnection:
193198 self ._address ,
194199 database = self ._database ,
195200 timeout = self ._timeout ,
201+ max_total_rows = self ._max_total_rows ,
196202 )
197203 try :
198204 await conn .connect ()
You can’t perform that action at this time.
0 commit comments