This is what's working for me with 0.5.3

raw_cs = "SERVER=%s;DATABASE=%s;UID=%s;PWD=%s" % (server, database,
userid, password)
connection_string = "%s:///?odbc_connect=%s" % (databasetype,
urllib.quote_plus(raw_cs))
if databasetype in ['mssql']:
    connection_string += urllib.quote_plus(";DRIVER={SQL
Server};TDS_Version=8.0")

echoOn = True  # For debugging the SQL statements
engine = create_engine(connection_string, echo=echoOn)


If TDSVER is not seen and the default version is used, you may get
SystemError: 'finally' pops bad exception

Now that said I have also had to force the version with

./configure --with-tdsver=8.0
make
sudo make install

or

export TDSVER=8.0

or if you can't redeploy freetds copy freetds.conf to ~/.freetds.conf
and change the version in that file to 8.0

FreeTS, ODBC, pyODBC and then SQLAlchemy: what a house of cards!

~Matt


On Apr 7, 12:58 pm, Lukasz Szybalski <szybal...@gmail.com> wrote:
> Hello,
>
> Is this still proper connection string for mssql where I specify the
> tds version and a connection driver name?
>
>  e = 
> sqlalchemy.create_engine("mssql://user:p...@server:1433/db_name?driver=TDS&odbc_options='TDS_Version=8.0'")
>
> What is the syntax for driver, and how can I pass "TDS_Version=8.0" to
> the end of connection string?
>
> Thanks,
> Lucas
>
> File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/pool.py",
> line 198, in __init__
>     self.connection = self.__connect()
>   File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/pool.py",
> line 261, in __connect
>     connection = self.__pool._creator()
>   File 
> "/home/lucas/tmp/saENV/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/engine/strategies.py",
> line 80, in connect
>     raise exc.DBAPIError.instance(None, None, e)
> sqlalchemy.exc.DBAPIError: (Error) ('08001', '[08001]
> [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0)
> (SQLDriverConnectW)') None None
>
> --
> How to create python package?http://lucasmanual.com/mywiki/PythonPaste
> DataHub - create a package that gets, parses, loads, visualizes 
> datahttp://lucasmanual.com/mywiki/DataHub

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to