Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created March 18, 2013 14:01
Show Gist options
  • Save c0ldlimit/5187339 to your computer and use it in GitHub Desktop.
Save c0ldlimit/5187339 to your computer and use it in GitHub Desktop.
#python #pandas #sql Pyodbc query to dataframe
# http://stackoverflow.com/questions/13570178/itter-from-some-odbc-connection-to-pandas-table-with-out-a-csv
import pyodbc
import pandas.io.sql as psql
cnxn = pyodbc.connect(your_connection_info)
cursor = cnxn.cursor()
sql = ("""SELECT * FROM Source""")
df = psql.frame_query(sql, cnxn)
cnxn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment