| Store | Cart

DBAPI Paramstyle

From: Tim Roberts <t...@probo.com>
Sat, 26 Mar 2005 00:54:09 -0800
Bob Parnes <rparnes at megalink.net> wrote:
>>I have a mediocre talent at programming, which is why I chose python.>For me it was a good choice. I note this so that I hope you understand why>I say that I don't know what you are driving at. My understanding is that a >paramstyle is more efficient than the traditional python approach for repeated >use of a query. If so, then I do not see how the choice of a parameter is>relevant. If it is more efficient only in a specific abstract case, then>one would have to look for other reasons to use it in a practical application.

In theory, using a paramstyle allows the query to be sent to the SQL
database backend and compiled like a program.  Then, successive uses of the
same query can be done by sending just the parameters, instead of sending
the entire query string to be parsed and compiled again and again.  This is
commonly done with large production databases like SQL Server and Oracle.
For a complicated query, it can be a significant time savings.

However, to the best of my knowledge, none of the Python dbabi
implementations actually do that.  So, the primary benefit of the
paramstyle method is that the database provider inserts whatever quoting is
required; you don't have to remember to put single quotes around the
arguments, and protect single quotes within the arguments by doubling them,
and so on.
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.

Recent Messages in this Thread
Bob Parnes Mar 24, 2005 01:45 pm
Fredrik Lundh Mar 24, 2005 02:03 pm
Bob Parnes Mar 25, 2005 01:44 pm
Tim Roberts Mar 26, 2005 08:54 am
wood...@rocketmail.com Mar 26, 2005 10:16 am
Scott David Daniels Mar 26, 2005 02:27 pm
Andy Dustman Mar 28, 2005 09:43 pm
Gerhard Haering Mar 28, 2005 10:57 pm
Messages in this thread