Pass parameters to cursor.execute('Listen ')?

Поиск
Список
Период
Сортировка
От Dumitru Melenteanu
Тема Pass parameters to cursor.execute('Listen ')?
Дата
Msg-id 57442454.9020206@dekart.com
обсуждение исходный текст
Ответы Re: Pass parameters to cursor.execute('Listen ')?  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
When performing LISTEN on a channel, passing parameters results in a
syntax error

    >>> cursor.execute('Listen %s', ('hello',))`

    ProgrammingError: syntax error at or near "'hello'"
    LINE 1: Listen 'hello'

The only way I could get it to work is to % format it, which seems to be
very frowned upon in the documentation, with good reason, and would
prevent using `executemany` for multiple channels.

    >>> cursor.execute('Listen %s'% ('hello',))

Is there any way to pass the channel as a parameter?


Вложения

В списке psycopg по дате отправления:

Предыдущее
От: Levente Kovacs
Дата:
Сообщение: Re: install on windows
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Pass parameters to cursor.execute('Listen ')?