Re: [psycopg] Solving the SQL composition problem

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: [psycopg] Solving the SQL composition problem
Дата
Msg-id f7cc0d30-7edc-285a-45f3-4c66febf19b4@aklaver.com
обсуждение исходный текст
Ответ на Re: [psycopg] Solving the SQL composition problem  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список psycopg
On 01/02/2017 07:05 AM, Jim Nasby wrote:
> On 1/1/17 2:11 AM, Daniele Varrazzo wrote:
>>         sql.SQL("insert into %s values (%%s)") %
>> [sql.Identifier('mytable')],
>
> Since %s isn't standard parameter replacement anyway, I'm wondering if
> both considerations could just be handled by execute(), by using
> different replacement syntax. IE:

I thought it was?:

https://www.python.org/dev/peps/pep-0249/#paramstyle

format     ANSI C printf format codes, e.g. ...WHERE name=%s

>
> execute('insert into %s values ($1)', [42], ['my table'])
>
> Obviously this would be backwards incompatible, but I think that's
> manageable.


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [psycopg] Solving the SQL composition problem
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: [psycopg] speed concerns with executemany()