Re: Server side prepared statements and executemany - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Server side prepared statements and executemany
Date
Msg-id CA+mi_8Z4Tt0oVkBZr0RqwdXOqTPeTszCdzEZNoasLN5fEt_9TQ@mail.gmail.com
Whole thread Raw
In response to Re: Server side prepared statements and executemany  (Luca Ferroni <luca@befair.it>)
Responses Re: Server side prepared statements and executemany
List psycopg
On Fri, Nov 15, 2013 at 12:34 PM, Luca Ferroni <luca@befair.it> wrote:

> Prepared statements work with query like:
>
> prepare psyco_1 as SELECT * FROM "prova" WHERE "name" = $1
>
> but they raise ProgrammingError (syntaxerror SQL) with the operator IN
>
> prepare psyco_1 as SELECT * FROM "prova" WHERE "name" IN $1

I suspect the () of IN are a syntactic feature and cannot be passed as
a parameter.

Do you want to try to replace the query with "... WHERE name =
any($1)" and pass the parameter as a python list instead of a tuple?
(see also http://initd.org/psycopg/docs/usage.html#adapt-list)

-- Daniele


psycopg by date:

Previous
From: Luca Ferroni
Date:
Subject: Re: Server side prepared statements and executemany
Next
From: Joe Abbate
Date:
Subject: Re: Server side prepared statements and executemany