Re: Database adaptors?

Sebastien Bigaret <[email protected]> 03 Mar 2004 08:21:01 +0100
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
        Hi Fede,

Federico Heinz <[email protected]> wrote:
> We're in contact with a prospective Modeling user. For reasons I'd
> rather not go into (my doctor is worried about my blood pressure), these
> people are likely to want to use it with DB2, for which no adaptor layer
> is available yet.
> 
> This would be a nice opportunity for us to contribute said adaptor layer
> to Modeling. I've taken a brief look at the available layers, and they
> all seem pretty short and straightforward. Before attempting a go at it,
> though, I'd like to ask the people who have written the other adaptors
> whether there are any pitfalls to avoid

 I can speak for the people who have written the other adaptors ;)

Yes, as you already observed it, writing a db adaptor is not really a
problem given that the python adaptor exists, and that the db does not
show too much differences wrt the SQL standards. As an example, I can
cite mysql, whose earlier version did not accept INNER JOINS, or Oracle
who requires a special statement to handle dates as expected.

  Now the best (and/or quicker) way to write a new adaptor is to derive
  it from an existing one --and, of course, to use the 3 scripts
  test_EC_Global.py, test_Global_Inheritance.py and
  test_EC_ParentChild.py to test it.  Integration of a new adaptor in
  these scripts should not be a problem: add an argument to '-d', and
  write a new configuration file, say, DB2.cfg.

Last and to be complete, as you probably already noticed when looking at
other adaptors, the AbstractDBAPI2Adaptor layer implements all common
things needed by concrete adaptors relying on a DB-API 2.0 compliant
python adaptor.

> [asking about] what a reasonable time
> estimate for writing the adaptor would be.

I'd say one to two days if you're already familiar with the db and the
corresponding python adaptor.

  I'd be really pleased if you could find some time to develop a new
  adaptor, and would happily integrate it into the framework! And, of
  course, I'll be there if you need more details during the
  dev. effort... to help you keep your blood pressure between reasonable
  values ;)

BTW, we could also take this opportunity to start writing a draft of a short
document on "how to derive a new adaptor".

-- Sébastien.




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click