Il giorno lun, 08/01/2007 alle 19.01 +0100, Harald Armin Massa ha
scritto:
> within PostgreSQL and psycopg2 I can write:
> 
> cs.execute("""select name from kundentable
>                    where id_p = any(%(ids)s)""",
>                   dict(ids=[8718, 27339, 108509463, 9113, 14951]))
> 
> which gets translated to
> cs.query
> 'select name from kundentable
>  where id_p = any(ARRAY[8718, 27339, 108509463, 9113, 14951])' 

Completely off-topic but in psycopg2 you can do even better if you
import psycopg2.extras and then use a tuple. It will get adapted into
the right parenthesized form for SQL IN operator.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [EMAIL PROTECTED]
INIT.D Developer                                           [EMAIL PROTECTED]
             I'm hung like Einstein and smart as a horse! -- Trottalemme

Attachment: signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to