1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00

Added pyodbc samples

This commit is contained in:
Meet Bhagdev
2016-07-25 00:48:25 -07:00
parent 226908823c
commit 47a16cfe04
10 changed files with 100 additions and 65 deletions

View File

@ -0,0 +1,26 @@
# Connect to SQL Database by using Python on Ubuntu Linux
[Python code sample] (sample_python_linux.py) that runs on an Ubuntu Linux client computer, to connect to an Azure SQL Database database.
## Requirements
- [Python 2.7.6](https://www.python.org/download/releases/2.7.6/).
### Install the required modules
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
## Create a database and retrieve your connection string
See the [getting started page](http://azure.microsoft.com/documentation/articles/sql-database-get-started/) 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.