From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | David Kerr <dmk(at)mr-paradox(dot)net> |
Cc: | psycopg(at)postgresql(dot)org |
Subject: | Re: Insert with a lot of columns |
Date: | 2014-01-01 00:11:31 |
Message-ID: | 52C35D33.1030308@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 12/31/2013 03:47 PM, David Kerr wrote:
>
> On Dec 31, 2013, at 1:30 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
>
>> On 12/31/2013 10:56 AM, David Kerr wrote:
>>>
>>> On Dec 31, 2013, at 10:50 AM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)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(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2014-01-07 12:54:16 | Psycopg 2.5.2 released |
Previous Message | David Kerr | 2013-12-31 23:47:27 | Re: Insert with a lot of columns |