1import pandas as pd
2import pyodbc
3conn = pyodbc.connect('Driver={SQL Server};'
4 'Server=servername;'
5 'Database=databasename;'
6 'Trusted_Connection=yes;')
7cur= conn.cursor()
8sqlquery = pd.read_sql_query('SELECT * FROM tablename',conn)
9print(sqlquery)