Re: Error in a simple query (SOLVED)

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Error in a simple query (SOLVED)
Дата
Msg-id CA+mi_8ZUpRds--M3uAoHNK4pwoxO7hK5DF73ntHYCBAYTjBk1A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Error in a simple query (SOLVED)  (Gustavo <gmpuljak@yahoo.com.ar>)
Список psycopg
On Tue, Jun 25, 2013 at 12:18 AM, Gustavo <gmpuljak@yahoo.com.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


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

Предыдущее
От: Gustavo
Дата:
Сообщение: Re: Error in a simple query (SOLVED)
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Problem with the default registration of the JSON adapter