Re: Adaptation in psycopg3

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: listas <listas(at)soft-com(dot)es>, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: Adaptation in psycopg3
Date: 2020-11-25 14:35:21
Message-ID: 7d110c22-f645-0dc4-1d98-3f8c40604c9e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 11/25/20 4:29 AM, listas wrote:
> El 24/11/20 a las 17:52, Daniele Varrazzo escribió:
>> Hello,
>>
>> I wrote a description of the psycopg3 adaptation system and the main
>> differences compared to psycopg2: available at
>> https://www.psycopg.org/articles/2020/11/24/psycopg3-adaptation/
>>
>> Initial API docs are available at
>> https://www.psycopg.org/psycopg3/docs/adaptation.html
>>
>> Feedback is welcome. Cheers!
>>
>> -- Daniele
>>
>
> Hi Daniele, thanks for your effort.
>
> After reading the docs i have a question about the parameters in the
> 'in' clause.
>
> In psycopg2 i do:
>
>  params = (1,2,3,4)
>  cursor.execute("select * from mytable where field1 in %s", (params,))
>
> or
>
>  params = ('black','red','green')
>  cursor.execute("select * from mytable where field2 in %s", (params,))
>
> What will it be like in psycopg3, will it be the same?, will I have to
> create a special adapter?

From the link:

"cannot use the IN (...) construct:

# Must use "AND nation = any (%s)"
cur.execute("... AND nation in %s", [("IT", "FR", "DE")])

"

>
> Thanks
> --
> Oswaldo Hernández
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2020-11-25 14:45:30 Re: Adaptation in psycopg3
Previous Message listas 2020-11-25 12:29:46 Re: Adaptation in psycopg3