use a python library called pyodbc pip install pyodbc, you will also need to download the relavant SQL driver for the type and version of what SQL you are using.