Re: contrib: hack for psycopg2 performance
Daniele Varrazzo <[email protected]> Wed, 12 May 2010 12:11:25 +0100
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, May 12, 2010 at 11:49 AM, Karsten Hilbert <[email protected]> wrote: > On Mon, May 10, 2010 at 10:54:46PM +0100, Daniele Varrazzo wrote: >> PQexecParams has the shortcoming of being able to send only a query at >> time, whereas PQexec allows to send any number in a single string, >> separated by semicolons. Many people use this feature and dropping it >> would be an incompatible change. > > While that's understood and appreciated, would it be an > option to allow the user to tell psycopg2 > > "yes, I know I can only use single queries per > invocation but I do want you to use PQexecParams" I feel this as a "don't make me choose" case [1]. _Assuming_ that psycopg will work fine in both cases, *Params and not *Params (in the set of queries accepted by the more restrictive), why should the user be loaded with the burden of choosing which one to use? [1] http://www.joelonsoftware.com/uibook/fog0000000249.html (chapter 3) There is a big fat assumption above, but psycopg doesn't use (anymore) its own quoting algorithm, which may be flawed: it is using the libpq PQescapeStringConn, so we can assume it is as secure as the backend is. > I know I would use that in GNUmed. Would you choose the *Param way because you don't trust psycopg in performing the right escape or for some other reason? -- Daniele