Re: Unpacking a Python list in a query.

From: Sukhbir Singh <singheinstein(at)gmail(dot)com>
To: Israel Ben Guilherme Fonseca <israel(dot)bgf(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Unpacking a Python list in a query.
Date: 2011-06-24 19:35:13
Message-ID: BANLkTim+DORxOWLR64m_TWOCyEt4AWBbOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

Hi,

> execute("UPDATE foobartable SET name = 'FooBar' WHERE name in (%s)",
> (tuple(yourlist),))
>
> That should work.

I get this error:

psycopg2.ProgrammingError: arguments of row IN must all be row expressions
LINE 1: UPDATE listarchives SET name='FooBar' WHERE name in ((E'Foo...

I am passing a tuple only.

In response to

Browse psycopg by date

  From Date Subject
Next Message David Niergarth 2011-06-24 19:36:16 Re: Unpacking a Python list in a query.
Previous Message Israel Ben Guilherme Fonseca 2011-06-24 19:25:02 Re: Unpacking a Python list in a query.