Intro... I, together with Mark Rees, wrote most of adonet-dbapi code in 2006.

2009/10/28 Markus Törnqvist <[email protected]>:
> Here's the connect function (in its entirety) from mssql.py
>
> def connect(connstr):
>    relevant_parts = [part for part in connstr.split(';') if not 
> part.upper().startswith('PROVIDER')]
>    connstr = ';'.join(relevant_parts)
>    #return generic_connect("System.Data", 
> "System.Data.SqlClient.SqlConnection", connstr)
>
> Way too hacky for my taste but it gets the job kinda done.

Indeed. The question is, what underlying Python DB-API 2 driver does
django-mssql use? Is it http://pymssql.sourceforge.net/ ?

Argument to connect() function in Python DB-API 2 compliant drivers is
not standardized. In case of pymssql, it receives keyword arguments,
so it should be handled in a manner similar to MySQLdb.py wrapper in
adonet-dbapi. But from your hack it seems django-mssql's underlying
Python DB-API 2 driver expects a string argument, so django-mssql is
building string by itself -- this is ungood. Read psycopg.py wrapper
in adonet-dbapi to see how to handle this.

On the other hand, as I understand, Django does not handle paramstyle
difference in DB-API 2 drivers, so this is kind of a lost cause. How
do other Django DB backends deal with the issue? SQLAlchemy,
fortunately, handles paramstyle difference by itself.

-- 
Seo Sanghyeon
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to