[orm-devel] ORM adapter for Firebird by Werner F. Bruhin

Diedrich Vorberg orm-devel@mailman.tux4web.de
Thu, 20 Feb 2003 18:12:19 +0100


Hi All,

Werner F. Bruhin wrote to me today about a new database adapter he's 
working on. I'll paste his original posting below and then reply to 
my own posting to avoid sending the source through the list. It will 
be available in the CVS shortly.

Diedrich

-------------

Dear Diedrich,

I would like to evaluate ORM (version 0.8) and SQLObjects (managed to 
get it working with Firebird) for a project,  but want to use it with 
Firebird.  So, I started putting a ORM-Firebird adapter together - 
looking at MySql and PostGre adapters you did and copied/pasted and 
changed a little.

Please keep in mind that I am new to Python and on top I am a hobby 
programer!

Firebird is different to PostGre and MySql in how it handles 
autoinc/sequence columns.  It has a generator and one can either use a 
trigger to generate the ID and would then have to do a query to get it 
(not sure that this can be done in a way which is 100% reliable), 
another method is to call a stored procedure which returns the ID to be 
used and insert that into the object before the actual insert is done - 
I prefer the later method.

My current problem is that I am not sure how to get to the connection 
and create a cursor and call the stored procedure.

If you have a moment could you glance at the attached datasource.py file 
and point me in the right direction on how I should deal with this in 
the insert function.

Another question, in my test script (see full script below) I have to insert

"from orm.adapters.firebird.columns import * "

to get the firebird columns, should that be automatically loaded by 
orm.datasources depending on what adapter type one is requesting??

Would appreciate any hints/help on this.

Best regards
Werner