[IronPython] Django 1.1 on IronPython 2.6rc2 findings
mjt at nysv.org
Wed Oct 28 15:14:09 CET 2009
On Wed, Oct 28, 2009 at 10:53:45PM +0900, Seo Sanghyeon wrote:
>Intro... I, together with Mark Rees, wrote most of adonet-dbapi code in 2006.
>2009/10/28 Markus Törnqvist <mjt at nysv.org>:
>> 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/ ?
It's on adonet-dbapi...
>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.
Ok, something like that could be used instead.
>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.
I'd have to create the param dict from the connect string, very
much like your psycopg :)
Django is intended to use the dbapi, I don't think there's any other
way of handling this?
Anyway, I think the StackOverflowException is a bigger issue :)
More information about the Ironpython-users