ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]'URL' не является распознаваемым параметром ВОССТАНОВЛЕНИЯ. (155) (SQLExecDirectW)")
есть ли способ восстановить несколько файлов .bak или обойти мой код?
Код: Выделить всё
import pyodbc
import pandas as pd
server = "[REDACTED]"
username = "[REDACTED]"
password = "[REDACTED]"
conn_str = "[REDACTED]"
# Establish connection
conn = pyodbc.connect(conn_str)
conn.autocommit = True
cursor = conn.cursor()
sas_token = '[REDACTED]'
url = 'https://[REDACTED]/PROD_2009_1round.bak'
url2 = 'https://[REDACTED]/PROD_2009_2round.bak'
# Define restore command using the credential object
restore_command = f"""
RESTORE DATABASE [PROD_2009]
FROM URL = '{url}'
WITH FILE = 1, NOUNLOAD, STATS = 10,
URL = '{url2}',
WITH FILE = 2;
"""
# Execute restore command
cursor.execute(restore_command)
# Close cursor and connection
cursor.close()
conn.close()
Код: Выделить всё
restore_command = f"""
RESTORE DATABASE [PROD_2009]
FROM URL = '{url}', URL = '{url2}';
"""
Подробнее здесь: https://stackoverflow.com/questions/791 ... -bak-files