Summary
mssql_python fails when executing a StatementStack through SQLSpec execute_stack().
While adding SQL Server coverage in Litestar Queues, a stale-recovery path that batches several UPDATE statements into a StatementStack failed for the SQLSpec mssql_python adapter with:
NotImplementedError: Adapters must override _connection_in_transaction()
Environment
sqlspec==0.52.0
mssql-python==1.10.0
pymssql==2.3.13
- Python 3.14.4
- SQL Server 2022 via
pytest-databases (mcr.microsoft.com/mssql/server:2022-latest)
Reproduction Shape
The queue backend builds a StatementStack of UPDATE statements and calls:
stack = StatementStack()
for statement in statements:
stack = stack.push_execute(statement)
await driver.execute_stack(stack)
Against mssql_python, this raises from SQLSpec internals:
sqlspec/driver/_async.py:1453: in execute_stack
sqlspec/driver/_async.py:1675: in _connection_in_transaction
NotImplementedError: Adapters must override _connection_in_transaction()
A local workaround is to avoid execute_stack() for SQL Server and execute the statements one-by-one in a transaction/session. That works for the queue backend contract.
Expected
mssql_python should either support execute_stack() or provide the transaction-state hook required by SQLSpec stack execution.
Actual
execute_stack() raises NotImplementedError before applying the batch.
Summary
mssql_pythonfails when executing aStatementStackthrough SQLSpecexecute_stack().While adding SQL Server coverage in Litestar Queues, a stale-recovery path that batches several
UPDATEstatements into aStatementStackfailed for the SQLSpecmssql_pythonadapter with:Environment
sqlspec==0.52.0mssql-python==1.10.0pymssql==2.3.13pytest-databases(mcr.microsoft.com/mssql/server:2022-latest)Reproduction Shape
The queue backend builds a
StatementStackofUPDATEstatements and calls:Against
mssql_python, this raises from SQLSpec internals:A local workaround is to avoid
execute_stack()for SQL Server and execute the statements one-by-one in a transaction/session. That works for the queue backend contract.Expected
mssql_pythonshould either supportexecute_stack()or provide the transaction-state hook required by SQLSpec stack execution.Actual
execute_stack()raisesNotImplementedErrorbefore applying the batch.