On Mon, Mar 31, 2008 at 12:21 PM, Rick Morrison <[EMAIL PROTECTED]> wrote:
> It looks to me as if you have unixodbc installed, but don't have a SQL
> Server driver installed, or it's named differently.
>
> Unixodbc drivers are here:
>     http://www.unixodbc.org/drivers.html
>
> I'm not really up on my unixodbc config, so I don't know where or how the
> driver names are configured.
>
>
> > As you can see I can connect via pyodbc if I pick TDS as a driver. Is
>
> > there a way to tell sqlalchemy to use TDS driver?
>
> I've added a keyword parameter 'driver' to the MSSQL/pyodbc dialect in
> r4386. Will substitute in the ODBC connection string, defaults to 'SQL
> Server'. Give that a try if you can't otherwise resolve the naming issue.
>

You didn't say how am I supposed to use it in create engine?

What will be create_engine that is equivelent to:
pyodbc.connect('DRIVER={TDS};Server=localhost;UID=user;PWD=pass')

Like this:
sqlalchemy.create_engine('mssql://user:[EMAIL PROTECTED]:1433/?driver=TDS')????



Anyway. I went into  sqlalchemy/databases/mssql.py
changed the line 791 to:    self.drivername = params.get('driver', 'TDS')
but I still get the:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "sqlalchemy/schema.py", line 110, in __call__
    return type.__call__(self, name, metadata, *args, **kwargs)
  File "sqlalchemy/schema.py", line 226, in __init__
    _bind_or_error(metadata).reflecttable(self,
include_columns=include_columns)  File "sqlalchemy/engine/base.py",
line 1271, in reflecttable
    conn = self.contextual_connect()
  File "sqlalchemy/engine/base.py", line 1239, in contextual_connect
    return Connection(self, self.pool.connect(),
close_with_result=close_with_result, **kwargs)
  File "sqlalchemy/pool.py", line 178, in connect
    agent = _ConnectionFairy(self)
  File "sqlalchemy/pool.py", line 321, in __init__
    rec = self._connection_record = pool.get()
  File "sqlalchemy/pool.py", line 188, in get
    return self.do_get()
  File "sqlalchemy/pool.py", line 613, in do_get
    con = self.create_connection()
  File "sqlalchemy/pool.py", line 153, in create_connection
    return _ConnectionRecord(self)
  File "sqlalchemy/pool.py", line 216, in __init__
    self.connection = self.__connect()
  File "sqlalchemy/pool.py", line 279, in __connect
    connection = self.__pool._creator()
  File "sqlalchemy/engine/strategies.py", line 80, in connect
    raise exceptions.DBAPIError.instance(None, None, e)
SystemError: 'finally' pops bad exception


Lucas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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