public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniele Varrazzo <[email protected]>
To: Denis Laxalde <[email protected]>
Cc: [email protected]
Subject: Re: about client-side cursors
Date: Wed, 10 Feb 2021 13:43:39 +0100
Message-ID: <CA+mi_8a4A9-fu39sLzvGbeqF9odLBNuyORfMc5K4yv=XgZQjsA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Wed, 3 Feb 2021 at 17:16, Denis Laxalde <[email protected]> wrote:
> Why do we need two 'await' (i.e. two IO operations) on conn.execute()
> and cur.fetchall() if 'cur' is a client-side cursor? (Back to my first
> point about where IO happen, this appears to depend on whether the
> connection has 'autocommit' or not...)
Around this point, one arguably not useful `await` is on
`connection.cursor()`. I wanted to put some flesh around server-side
cursors before making my mind around it. Now I have, as I am working
in a server-side cursor branch, and I don't think there are reasonable
cases where `connection.cursor()` might do I/O.
So, in the server-side branch, I've made the function non-async on
AsyncConnection too. This makes also context manager better to use, as
now you can do:
async with aconn.cursor() as cur:
# use it
whereas previously it would have taken an `async with await aconn.cursor()`.
I assume the change is welcome, but please let me know if this is not the case.
Cheers
-- Daniele
view thread (22+ 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]
Subject: Re: about client-side cursors
In-Reply-To: <CA+mi_8a4A9-fu39sLzvGbeqF9odLBNuyORfMc5K4yv=XgZQjsA@mail.gmail.com>
* 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