public inbox for [email protected]
help / color / mirror / Atom feedFrom: Karsten Hilbert <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: about client-side cursors
Date: Fri, 5 Feb 2021 11:45:46 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+mi_8YoLnH1XgXjKoGCaYY2qLk2XjVexHe1q-j4KxjACF9y2A@mail.gmail.com>
References: <[email protected]>
<CA+mi_8a1ery2xvb+AdxMtVXydOdGC7wRMnfXNAvk8v73HsLFyw@mail.gmail.com>
<[email protected]>
<CA+mi_8YoLnH1XgXjKoGCaYY2qLk2XjVexHe1q-j4KxjACF9y2A@mail.gmail.com>
Am Fri, Feb 05, 2021 at 11:40:31AM +0100 schrieb Daniele Varrazzo:
> > class connection:
> > def execute(self, query, vars)
> > cur = self.cursor()
> > cur.execute(query, vars)
> > return cur.fetchall()
> >
> > makes even more sense ?
> >
> > Perhaps even reconsider naming it "execute".
>
> If it didn't return a cursor, it would make sense to reconsider
> calling it execute(). As it is now it returns the same that cursor
> returns, it's pretty much just a contraption of a chain of methods,
> hence the same name.
>
> If you return just the fetchall list you lose access to results
> metadata (description), nextset, and someone will come asking "can I
> have executefetchone() please" the next minute :)
Yeah, I know. Therefore I thought maybe "conn.run_query()" or
some such because execute() is already loaded with meaning.
If one wants access to what a cursor provides, as defined by
the DB-API, one should _use_ a cursor, as per DB-API :-)
Or, perhaps, it returns a generator over the fetchall()
results list ?
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
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: <[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