From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | tango ward <tangoward15(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: psycopg2.DataError: invalid input syntax for integer: "" |
Date: | 2018-05-07 13:40:39 |
Message-ID: | CAKFQuwbUkSrPCtjtdhsr7S180GJMTuSQ=0O7FqO3EOP=47Pw+A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, May 7, 2018 at 6:35 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2018-05-07 13:49:38 | Re: psycopg2.DataError: invalid input syntax for integer: "" |
Previous Message | Adrian Klaver | 2018-05-07 13:35:30 | Re: psycopg2.DataError: invalid input syntax for integer: "" |