python get backup of sql

Solutions on MaxInterview for python get backup of sql by the best coders in the world

showing results for - "python get backup of sql"
Giacomo
08 Mar 2016
1>>> import pyodbc
2>>> connection = pyodbc.connect(driver='{SQL Server Native Client 11.0}', 
3                                server='InstanceName', database='master', 
4                                trusted_connection='yes', autocommit=True)
5>>> backup = "BACKUP DATABASE [AdventureWorks] TO DISK = N'AdventureWorks.bak'"
6>>> cursor = connection.cursor().execute(backup)
7>>> connection.close()
8