From: | Christopher Brooks <brooksch(at)umich(dot)edu> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Christophe Pettus <xof(at)thebuild(dot)com>, psycopg(at)postgresql(dot)org |
Subject: | Re: VARCHAR versus TEXT when using psychopg2, sqlalchemy and redshift |
Date: | 2015-08-30 20:10:07 |
Message-ID: | CAJQ6OJNmLL61bXAeh_9E86rY6ic_pGf4s4Dp7OvGbtnng6P0cA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Thanks for this Adrian and Christophe, this was the issue!
Regards,
Chris
On Sun, Aug 30, 2015 at 3:49 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 08/30/2015 12:04 PM, Christopher Brooks wrote:
>
>> Yes, this is what I was aiming to do. Maybe I've got the sql alchemy
>> syntax wrong? I though insert().values took in iterables for row by row
>> inserts...
>>
>>
> Think you want to take a look here:
>
>
> http://docs.sqlalchemy.org/en/rel_1_0/core/dml.html#sqlalchemy.sql.expression.Insert.values
>
> in particular:
>
> The Insert construct also supports multiply-rendered VALUES construct, for
> those backends which support this SQL syntax (SQLite, Postgresql, MySQL).
> This mode is indicated by passing a list of one or more dictionaries/tuples:
>
> users.insert().values([
> {"name": "some name"},
> {"name": "some other name"},
> {"name": "yet another name"},
> ])
>
>
> Chris
>>
>> On Sun, Aug 30, 2015 at 3:01 PM, Christophe Pettus <xof(at)thebuild(dot)com
>> <mailto:xof(at)thebuild(dot)com>> wrote:
>>
>>
>> On Aug 30, 2015, at 11:59 AM, Christopher Brooks <brooksch(at)umich(dot)edu
>> <mailto:brooksch(at)umich(dot)edu>> wrote:
>> > [SQL: 'INSERT INTO qualtrics_dim (k, v) VALUES (%(k)s, %(v)s)']
>> [parameters: {'v': ['aa', 'bb'], 'k': ['a', 'b']}]
>>
>> The values you've written there are two arrays of TEXT values, but
>> the columns aren't declared as TEXT or VARCHAR arrays, but as single
>> VARCHAR values. Are you trying to insert two rows of the form 'aa',
>> 'a' and 'bb', 'b'?
>>
>> --
>> -- Christophe Pettus
>> xof(at)thebuild(dot)com <mailto:xof(at)thebuild(dot)com>
>>
>>
>>
>>
>> --
>> Christopher Brooks, PhD
>> Research Fellow
>>
>> E-Mail: brooksch(at)umich(dot)edu <mailto:brooksch(at)umich(dot)edu>
>> Web: http://www.si.umich.edu/people/christopher-brooks
>>
>> Mail:School of Information
>> University of Michigan
>> 4322 North Quad
>> 105 S. State St.
>> Ann Arbor, MI 48109-1285
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
--
Christopher Brooks, PhD
Research Fellow
E-Mail: brooksch(at)umich(dot)edu
Web: http://www.si.umich.edu/people/christopher-brooks
Mail:School of Information
University of Michigan
4322 North Quad
105 S. State St.
Ann Arbor, MI 48109-1285
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos Sotto Maior (UOL) | 2015-09-27 01:28:30 | Help needed building syscopg2 |
Previous Message | Adrian Klaver | 2015-08-30 19:49:44 | Re: VARCHAR versus TEXT when using psychopg2, sqlalchemy and redshift |