As part of artifacts delivery, our developers give the data and structure scripts in .sql files. I usually "double click" on these files to open in "Microsoft SQL Server Management Studio". Management studio will prompt me for entering database server and user/pwd. I enter them manually and click on Execute button to execute these scripts.
These scripts contain structure and data sql commands. Each script may contain more than one data command (like select, insert, update, etc). Structure and data scripts are provided in separate .sql files.
These scripts also contain stored procedures and functions, etc. They also contain comments / description.
I want to automate execution of these scripts through python. I looked at pyodbc and pymssql but they dont look like solve my issue. Through pyodbc, i need to read each .sql file and read the sql commands and execute them one by one. As the files may have comments / description / SPs / etc, reading the files will be little difficult.
Can anyone give suggestion on how to automate this?
Thanks in advance.