Re: Server side prepared statements and executemany

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Server side prepared statements and executemany
Дата
Msg-id CA+mi_8Z4Tt0oVkBZr0RqwdXOqTPeTszCdzEZNoasLN5fEt_9TQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Server side prepared statements and executemany  (Luca Ferroni <luca@befair.it>)
Ответы Re: Server side prepared statements and executemany  ("P. Christeas" <xrg@linux.gr>)
Список 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 по дате отправления:

Предыдущее
От: Luca Ferroni
Дата:
Сообщение: Re: Server side prepared statements and executemany
Следующее
От: Joe Abbate
Дата:
Сообщение: Re: Server side prepared statements and executemany