[Python code sample] (sample_python_linux.py) that runs on an Ubuntu Linux client computer, to connect to an Azure SQL Database database.
Open your terminal and navigate to a directory where you plan on creating your python script. Enter the following commands to install FreeTDS and pymssql. pymssql uses FreeTDS to connect to SQL Databases.
sudo apt-get --assume-yes update
sudo apt-get --assume-yes install freetds-dev freetds-bin
sudo apt-get --assume-yes install python-dev python-pip
sudo pip install pymssql
See the getting started page to learn how to create a sample database and get your connection string. It is important you follow the guide to create an AdventureWorks database template. The samples shown below only work with the AdventureWorks schema.
