[DB-SIG] Databases chapter for Python on Windows book

M.-A. Lemburg mal@lemburg.com
Tue, 06 Jul 1999 18:00:12 +0200


Andy Robinson wrote:
> 
> As some of you know, Mark Hammona dna I are putting the finishing
> touches to "Python Programming for Win32", due from O'Reilly this
> autumn.  I'm doing the database chapter.  I hope you'll forgive me for
> asking for answers I could probably dig out with a lot of research,
> but I have a load of other subjects to research too.
> 
> The book needs to 'punch the right buttons' for corporate developers
> and IT managers and I am pushing the ideas of data cleaning and
> transformation scripts in Python.
> 
> Q1.  I know the ODBC API and the Python DB API provide support for
> precompiled SQL statements.  What I don't know is which databases and
> drivers actually use these to get better performance.  Can anyone help
> out on this?

mxODBC caches the last execute string on every cursor. If you
do:

stuff = 'select ... '
for i in range(10):
   cursor.execute(stuff,(i,))
   ...

mxODBC will prepare the statement once and then reuse it for
all subsequent calls.

Cheers, 
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   178 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/