-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Describe the bug
The following known issue with pyodbc also exists with mssql-python
To reproduce
import mssql_python
mssql_python.setup_logging()
cnxn = mssql_python.connect(
"SERVER=192.168.0.199;"
"DATABASE=master;"
"UID=scott;PWD=tiger^5HHH;"
"TrustServerCertificate=yes;"
)
cnxn.setautocommit(True)
crsr = cnxn.cursor()
for db_name in ["test", "test2", "test3"]:
if not crsr.execute("select name from sys.databases where name = ?", db_name).fetchval():
sql = f"CREATE DATABASE {db_name}"
print(sql)
crsr.execute(sql)
crsr.execute(
"ALTER SERVER CONFIGURATION SET SUSPEND_FOR_SNAPSHOT_BACKUP = ON;"
)
crsr.execute(
"BACKUP SERVER TO DISK = '/var/opt/mssql/backup/metadata/backup_1.bkm' WITH METADATA_ONLY, FORMAT;"
)
Expected behavior
The backup should succeed, as it does with ADODB (VBScript). For details, see
mkleehammer/pyodbc#1431 (comment)
Further technical details
Python version: 3.13
SQL Server version: SQL Server 2022
Operating system: Windows 11
Additional context
Client-side log:
mssql_python_trace_20251018_090446_10824.log
Server-side errorlog:
Metadata
Metadata
Assignees
Labels
No labels