Created
February 7, 2013 17:57
-
-
Save justinlewis/4732805 to your computer and use it in GitHub Desktop.
Connect to a SQL Server database with pyodbc: http://www.easysoft.com/developer/languages/python/pyodbc.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Just some notes for the future. | |
import pyodbc | |
connect = pyodbc.connect('DRIVER={SQL Server};SERVER=your_host;DATABASE=your_database;UID=username;PWD=password') | |
cursor = connect.cursor() | |
print "Connection to TRIPS database established" | |
cursor.execute("select * from YOUR_TABLE;") | |
for row in cursor.fetchall(): | |
print row |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment