I am trying to connect mssql from python. For this I am using below code but looks like something is wrong with the connection. Can anyone help me ?
import sqlalchemy as sal from sqlalchemy import create_engine import pyodbc ##conn = pyodbc.connect('Driver={SQL Server Native client 11.0};server=localhost;database=Nifty;trusted_connection=yes;') engine = sal.create_engine('mssql+pyodbc://localhost/Nifty?driver=SQL+Server+Native+client+11.0?Trusted_Connection=yes') engine.execute('select top 2 * from [dbo].ABC') I am getting below error
InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') (Background on this error at: https://sqlalche.me/e/14/rvf5)
mssql+pyodbc://@localhost/Nifty/? …sal.create_engine('mssql+pyodbc://@localhost/Nifty/?driver=SQL+Server+Native+client+11.0?Trusted_Connection=yes'). But still getting same