Skip to content

Commit 2183f86

Browse files
authored
fix: MSSQL connection left in busy state after insert (#2171)
* Close cursor properly in `ODBCTransactionWrapper.execute_many` * Remove `SET NOCOUNT ON` which might not be necessary anymore * Revert * Trigger CI
1 parent a394ab2 commit 2183f86

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tortoise/backends/odbc/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def acquire_connection(self) -> ConnWrapperType:
186186
async def execute_many(self, query: str, values: list) -> None:
187187
async with self.acquire_connection() as connection:
188188
self.log.debug("%s: %s", query, values)
189-
cursor = await connection.cursor()
190-
await cursor.executemany(query, values)
189+
async with connection.cursor() as cursor:
190+
await cursor.executemany(query, values)
191191

192192
async def begin(self) -> None:
193193
self._finalized = False

0 commit comments

Comments
 (0)