2015-06-04 20 views
9

Sto provando a connettermi a un database sul mio computer locale.Connessione al database utilizzando SQLAlchemy

import sqlalchemy 
engine = sqlalchemy.create_engine('mssql+pyodbc://localhost\\SQLEXPRESS/NCM') 

Viene a mancare con il seguente errore:

DBAPIError: (pyodbc.Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') 

e uscite anche questo avvertimento:

C:\Miniconda\envs\bees\lib\site-packages\sqlalchemy\connectors\pyodbc.py:82: SAWarning: No driver name specified; this is expected by PyODBC when using DSN-less connections 
"No driver name specified; " 

Dove dovrei cercare di diagnosticare il problema?

risposta

13

Come mostrato in this link, dalla versione 1.0.0 è necessario specificare esplicitamente il driver per le connessioni hostname.

Changed in version 1.0.0: Hostname-based PyODBC connections now require the 
SQL Server driver name specified explicitly. SQLAlchemy cannot choose an 
optimal default here as it varies based on platform and installed drivers. 
Problemi correlati