Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7ycb-0006p5-Ak for psycopg@arkaria.postgresql.org; Fri, 05 Feb 2021 10:45:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l7yca-0000Bb-9t for psycopg@arkaria.postgresql.org; Fri, 05 Feb 2021 10:45:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7yca-0000BU-3p; Fri, 05 Feb 2021 10:45:52 +0000 Received: from mout.gmx.net ([212.227.15.15]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7ycX-0008F2-M8; Fri, 05 Feb 2021 10:45:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612521947; bh=aM60z9+3RgnZ5eP+5fBJXNK66uq8MhHZ73lkoV4+NEs=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=QLC+m0aN492uv4bh+e+EOSKlrr+RoaRPGKOgE5AlAK3MKu4TrVjitbuik6WvKD/C9 xQbTAfkE70day/KFRB0Sh8IbGI6VROPnYUnUF+5PWCxOV1COylxDWiHWjIpqIBd+w5 o5KEJlJIm+qY/VZr+vIuCDjL8wZ26ZrnZjokJaf4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([89.14.26.2]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MPog5-1lLXOC05sh-00Mr1c; Fri, 05 Feb 2021 11:45:47 +0100 Received: from ncq by hermes with local (Exim 4.94) (envelope-from ) id 1l7ycU-0006Pe-6y; Fri, 05 Feb 2021 11:45:46 +0100 Date: Fri, 5 Feb 2021 11:45:46 +0100 From: Karsten Hilbert To: psycopg@lists.postgresql.org, psycopg@postgresql.org Subject: Re: about client-side cursors Message-ID: Mail-Followup-To: psycopg@lists.postgresql.org, psycopg@postgresql.org References: <20210203161548.vkhu3qkpvmgvyhik@dalibo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:TjPoiB1oJBWv9J6wGeckx0dnBr3XfSXAzFl60PEv+6CWPSNAEoX SkEd07hY/KOXAdoWQghltf573FcHsGTKK6w+Ed49QXvEmXk/lYUcAlr2onQ5oOIefK8LT1h nGGu1Uv1p9tx9KLeQws0G3DXzWoMkbVxbNu6mQe5gAe7cxJBH3/EsflGaBwV+dt2DbFtahV rwQEHv1CkFXzlqE5AbqVg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:uz+T0vZ7tjs=:sdyT+agl2OwMtGgI5VWXGR afxurBLzs4gKk3z+UANBT7avnN9K1vSIrx1VwHcqrqoJ9yxk4e2jTQ3/lMKBGJlfBfpL7XADb WPKnRme9xU0OYaRkjMFmNhjICD/sqSKjtIEJH8G+7PxcB2WUbu1U45yGeADM3k61sbVEywNdx 53qGd6+fZrs+kt+6XLIRXvMAOZUb1fOI9C2L8IMPnA6tpdcSJpvpMf2Ziz2EGHkkGZsIhZa6P BtE/knzLHKgrdMfs0JdqbUwquhQttineDa0asee4hmF43kHeudGqCb2+wMLB6Ax/iqXda9O4X xC6bhTTYWDtOr4Ktq6XAAbO2I1Q/DJ+yI9Eue9o8MKFrZVHaZvKR8kqfceDjgG3g1NkXb5Krd hku9jW5zk+uttcZeTNXXefMFWtOHI5i/pi+z2mMPYRBRbaLg6v5UVUsQ3UEBbMPvYnltuS0B9 NA+/CKqx4XwViDOM3Z7U63rU1DlPn/goOLziPcQVZtC08yYLv+c6iaVxzZiVwsUIPK9hQbdt3 N7VO1EavzM1nnMZA+pbWh5x4UkwAumWtpR9gZyhhLhc8uiSfnu+7UUaeIrLlaE+/jGBGrid51 3WtWfFC4i90tD7opOBXYKS4/AjnRQZPYgj4yNHTJ8T5P8iHYgxmDzjTbZMGFR2g1kKZYXFQCE yMhai+LdjfC7s5V1m3ds6pBQeWBG9wKqM6/CFeDOtlOOWuVWS3XHzSFn6F7CuF0RnGA5x7sVW ifCVNgQkVEoOBE066ib15MBQyc9KL9pF8tRcGM67yskhs8MGNFPP5hsNPSfuxOUlYlWW23/23 ONuJbfAdMSNU2hmUAUe7wjPSr+6eMv/pEyAQqqu0LchNGBbXs80yImmg4+8Fsv25G1Tve2LQz IBdXL2M55iqHP2b9U3Vw== Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Am Fri, Feb 05, 2021 at 11:40:31AM +0100 schrieb Daniele Varrazzo: > > class connection: > > def execute(self, query, vars) > > cur =3D 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 =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B