Re: Insert with a lot of columns
От | Adrian Klaver |
---|---|
Тема | Re: Insert with a lot of columns |
Дата | |
Msg-id | 52C35D33.1030308@gmail.com обсуждение исходный текст |
Ответ на | Re: Insert with a lot of columns (David Kerr <dmk@mr-paradox.net>) |
Список | psycopg |
On 12/31/2013 03:47 PM, David Kerr wrote: > > On Dec 31, 2013, at 1:30 PM, Adrian Klaver <adrian.klaver@gmail.com> wrote: > >> On 12/31/2013 10:56 AM, David Kerr wrote: >>> >>> On Dec 31, 2013, at 10:50 AM, Adrian Klaver <adrian.klaver@gmail.com> wrote: >> >> Another alternative would be to use the psycopg COPY methods: >> >> http://initd.org/psycopg/docs/usage.html#copy > > Yeah, i’m doing more than just bulk moving data around so the select / insert pattern > is more appealing despite the lack of performance / simplicity / elegance of it. > > Thanks for the help. I got over the hump and got it working with %(name)s for everything. One way I tackled this was to use cursor.description to get the fields names and then build the parameter variables on the fly i.e '%(' + field_name + ')s' and use that to build a string to put into VALUES. > > > -- Adrian Klaver adrian.klaver@gmail.com
В списке psycopg по дате отправления: