Thank you so much for this snippet! It helped figure out my connectivity issues to Microsoft SQL Server.
On Thursday, December 23, 2010 1:42:42 PM UTC-5, Michael Bayer wrote: > > > On Dec 23, 2010, at 1:31 PM, Pirate Fibonacci wrote: > > > running on fedora 13. yum installed everything. > > got unixodbc installed and working, this includes iodbctest, isql, > > tsql, and the following works: > > > > import pyodbc > > cnxn = pyodbc.connect("DSN=Default;UID=user;PWD=passw") > > cursor = cnxn.cursor() > > cursor.execute("use database") > > cursor.execute("select * from table_name") > > rows = cursor.fetchall() > > for row in rows: > > print row > > > > > > > > I've feed almost all permutations of connect strings to > > create_engine... > > > > import sqlalchemy > > import pyodbc > > from sqlalchemy import Table, Column, MetaData, Date, Integer, > > create_engine > > > > engine = create_engine( "mssql+pyodbc://Default") > > metadata = MetaData(bind=engine) > > result = engine.execute("use Database") > > > > sqlalchemy.exc.DBAPIError: (Error) ('IM002', '[IM002] [unixODBC] > > [Driver Manager]Data source name not found, and no default driver > > specified (0) (SQLDriverConnectW)') None None > > > > is there a way to feed in pyodbc.connect in to create_engine, or what > > is the best way to chase down this error? > > If you want to see exactly what gets passed: > > python > >>> from sqlalchemy.engine.url import make_url > >>> from sqlalchemy.connectors import pyodbc > >>> > pyodbc.PyODBCConnector().create_connect_args(make_url("mssql+pyodbc://Default")) > [['dsn=Default;Trusted_Connection=Yes'], {}] > > There's a difference between your two tests in that one has > username/password, the other not. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.