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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to