-
-
Save savioserra/d97be2de131f155315abf823a965f094 to your computer and use it in GitHub Desktop.
Pandas and MSSQL
This file contains 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
import pymssql | |
import pandas as pd | |
## Hey Look, college data | |
stmt = "SELECT * FROM AlumniMirror..someTable" | |
## instance a python db connection object- same form as psycopg2/python-mysql drivers also | |
with pymssql.connect(server="<server address>", user="<user>",password="<password>", port=63642) as conn: # You can lookup the port number inside SQL server. | |
# Excute Query here | |
df = pd.read_sql(stmt,conn) | |
df.head(5) |
This file contains 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
pymssql==2.1.0 | |
pandas==0.14.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment