public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: listas <[email protected]>
To: Daniele Varrazzo <[email protected]>
To: [email protected]
Subject: Re: Adaptation in psycopg3
Date: Wed, 25 Nov 2020 06:35:21 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CA+mi_8ZYBu5V1hcKvsnMqgKayGvyMRJAMdMQVXvZ02QXsnt9yA@mail.gmail.com>
	<[email protected]>

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
[email protected]





view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Adaptation in psycopg3
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox