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. I'm using Psycopg if that makes any difference. Robert (Jamie) Munro
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - --On 20. November 2006 15:27:39 +0000 "Robert (Jamie) Munro" <jamie@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. - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFFYdHMCJIWIbr9KYwRAgZXAJ4qrZeaJCcrdCxd+6ZRDUl6QJtP9gCgydmm ggdl1BvUaCySn0B8HmcAOL8= =lWT+ -----END PGP SIGNATURE-----
Andreas Jung wrote:
--On 20. November 2006 15:27:39 +0000 "Robert (Jamie) Munro" <jamie@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
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@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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Robert (Jamie) Munro 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.
I'm using Psycopg if that makes any difference.
It is straightforward to do that from "trusted" product code. Look at how the ZSQLMethods work it, in $SOFTWARE_HOME/Products/ZSQLMethods/SQL.py (they derive from the 'DA' class in $SOFTWARE_HOME/Shared/DC/ZRDB/DA.py). Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFYdRI+gerLs4ltQ4RAvaaAKCmOk5Y78xc1lvf35X+hcClamtX+wCg0st4 OfWx3oWZaFhlznGjRs6AXRM= =uovX -----END PGP SIGNATURE-----
participants (4)
-
Andreas Jung -
Dario Lopez-Kästen -
Robert (Jamie) Munro -
Tres Seaver