Re: psycopg2.DataError: invalid input syntax for integer: ""

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: psycopg2.DataError: invalid input syntax for integer: ""
Дата
Msg-id CAKFQuwbUkSrPCtjtdhsr7S180GJMTuSQ=0O7FqO3EOP=47Pw+A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psycopg2.DataError: invalid input syntax for integer: ""  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Mon, May 7, 2018 at 6:35 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

            Not sure but I'm thinking you at least need to add single
            quotes around the %s symbols.  That doesn't really explain
            the integer input error though I'm not familiar with the
            exact features of the execute method in Python.

They do not need to be quoted:

http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries

​Yeah, upon further reflection overnight I figured it must incorporate sql-injection prevention.  The use of "%s", which is typically a printf construct and printf doesn't do that kind of thing, threw me.

David J.

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: psycopg2.DataError: invalid input syntax for integer: ""
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: psycopg2.DataError: invalid input syntax for integer: ""