[Zope] Python Database API

Dario Lopez-Kästen dario at ita.chalmers.se
Tue Nov 21 02:46:16 EST 2006


Robert (Jamie) Munro said the following on 11/20/2006 05:16 PM:
> Andreas Jung wrote:
>>
>> --On 20. November 2006 15:27:39 +0000 "Robert (Jamie) Munro" 
>> <jamie at textmatters.com> wrote:
>>
>>>> Is it possible to get to the python Database API through a database
>>>> connector in zope? I'd like to use things like
>>>> cursor.executemany(sql,seq_of_parameters) to make lots of queries run a
>>>> lot faster.
>> If you want to use the Python DB API inside Zope then better deal directly
>> with the database by using the Python DB API directly instead of misusing
>> the Zope DAs.
> 
> The trouble is that I want to use a mixture of normal ZSQL for most
> things, and python DBI executemany etc. for the speed critical parts, on
> the same database in the same zope site on different pages. If I change
> the database adaptor to point at another DB (e.g. for testing), I want
> it to change the DB pointed to by my python scripts as well.
> 
> Robert (Jamie) Munro

if you dig around the code for zsql methods, you will see that have a
method that returns the rendered sql (cannot remember what it's name is).

You could take this src and feed it, either to a Product that you have
written that has all the DB API stuff you need, or to a an external
method that uses the DB API.

/dario

-- 
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.
Lyrics applied to programming & application design:
"emancipate yourself from mental slavery" - redemption song, b. marley



More information about the Zope mailing list