Jan-31-2022, 09:06 AM
Hi, I am new to Python and I started immediately from importing data I am planning to analyse in pandas(?) to get tables, mean scores etc. I know how I can import that from excel but I have issues with importing data from ODBC. I can do it in excel, in SPSS and in R using this code:
abc <- odbcConnect("asa")
Country <- sqlQuery(abc, "SELECT * FROM dbo.tblCountry")
I am trying to replicate it in Python using this:
abc <- odbcConnect("asa")
Country <- sqlQuery(abc, "SELECT * FROM dbo.tblCountry")
I am trying to replicate it in Python using this:
import pandas.io.sql import pyodbc import sys server = 'asa' db = 'dbo.tblCountry' conn = pyodbc.connect(server=server, database=db) print(conn)Unfortunately, I have this error:
Error:pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
What am I doing wrong?