Re: psycopg2.DataError: invalid input syntax for integer: "" - Mailing list pgsql-general

From David G. Johnston
Subject Re: psycopg2.DataError: invalid input syntax for integer: ""
Date
Msg-id CAKFQuwbUkSrPCtjtdhsr7S180GJMTuSQ=0O7FqO3EOP=47Pw+A@mail.gmail.com
Whole thread Raw
In response to Re: psycopg2.DataError: invalid input syntax for integer: ""  (Adrian Klaver <adrian.klaver@aklaver.com>)
List 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 by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: psycopg2.DataError: invalid input syntax for integer: ""
Next
From: Adrian Klaver
Date:
Subject: Re: psycopg2.DataError: invalid input syntax for integer: ""