From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Gustavo <gmpuljak(at)yahoo(dot)com(dot)ar> |
Cc: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Re: Error in a simple query (SOLVED) |
Date: | 2013-06-25 09:55:09 |
Message-ID: | CA+mi_8ZUpRds--M3uAoHNK4pwoxO7hK5DF73ntHYCBAYTjBk1A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Tue, Jun 25, 2013 at 12:18 AM, Gustavo <gmpuljak(at)yahoo(dot)com(dot)ar> wrote:
> Adrian,
>
> thanks for the hint. The script was processing data from a txt file with
> several thousand lines and the problem was in a malformed insert from the
> bottom of the previous iteration.
No: the error is that you are composing the query manually instead of
letting psycopg joining the arguments to the query, as cleanly
documented at the very beginning of the manual, from the very first
example.
http://initd.org/psycopg/docs/usage.html
The page explains in details why running
>> > a = """select idbalizas from nuevo.balizas where %s %s %s %s""" % (emp1,
>> > dnid1, mem1, mmsi1)
>> > print
>> > cur.execute(a)
is an amazingly bad idea.
-- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2013-07-19 18:41:06 | Problem with the default registration of the JSON adapter |
Previous Message | Gustavo | 2013-06-24 23:18:55 | Re: Error in a simple query (SOLVED) |