Checkpoint before more window sizing work
This commit is contained in:
@@ -120,6 +120,7 @@ class AsyncMSSQLClient:
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
*,
|
||||
as_dict_rows: bool = False,
|
||||
commit: bool = False,
|
||||
) -> Dict[str, Any]:
|
||||
"""Execute a query and return a JSON-friendly payload.
|
||||
|
||||
@@ -128,6 +129,9 @@ class AsyncMSSQLClient:
|
||||
params: Optional named parameters bound to the statement.
|
||||
as_dict_rows: When ``True`` returns rows as dictionaries keyed by
|
||||
column name; otherwise rows are returned as lists.
|
||||
commit: When ``True`` the statement runs in a transaction that is
|
||||
committed on success. Useful for SQL batches that both mutate
|
||||
data and return a final result set.
|
||||
|
||||
Returns:
|
||||
A dictionary containing column names, rows and elapsed execution
|
||||
@@ -135,7 +139,7 @@ class AsyncMSSQLClient:
|
||||
"""
|
||||
await self._ensure_engine()
|
||||
t0 = time.perf_counter()
|
||||
async with self._engine.connect() as conn:
|
||||
async with (self._engine.begin() if commit else self._engine.connect()) as conn:
|
||||
res = await conn.execute(text(sql), params or {})
|
||||
rows = res.fetchall()
|
||||
cols = list(res.keys())
|
||||
|
||||
Reference in New Issue
Block a user