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 1kmeEj-00013s-RR for psycopg@arkaria.postgresql.org; Tue, 08 Dec 2020 14:45:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kmeEi-0004Ho-RB for psycopg@arkaria.postgresql.org; Tue, 08 Dec 2020 14:45:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmeEh-0004Hh-8j for psycopg@lists.postgresql.org; Tue, 08 Dec 2020 14:45:04 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmeEe-00081o-DJ for psycopg@lists.postgresql.org; Tue, 08 Dec 2020 14:45:02 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 561D4B12; Tue, 8 Dec 2020 09:44:58 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 08 Dec 2020 09:44:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=U Ce7E9+IjrYyNHqcnv3G22+73NdRxS5tDIYouEaJgAY=; b=LDtNwqlTq1ZzdrRAd M9p19jYgPipnHaHi98IfIZtMdsBMaMdVWlfWOLaeGAFbt+CsdrqTvQzhd8Qd4mga 47GhoY2bnzM7xw0Ica2sQ3MOQzeimJewrX0UGeymc6LRRtVEziSnttcqsuayf9GN 0U7UG0NLkzidQdwChVQ/nHL/b5XSL2buTiI1UGJMzApqb8h6AsgZlEW9dhMSFOJj BQrjeOPGSYkXubk+PTMG6fvqqDuGdHO8jy1tRnaTBpAmPaGeri3pLSruG6UPpO6z NwgxgWfmKRHP50GFlEiJ0zY/uQqbWEjM0jRkT5GIou6GgydaSTWx+41sFO2CVOjP Y+hSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=UCe7E9+IjrYyNHqcnv3G22+73NdRxS5tDIYouEaJg AY=; b=CIWFCYuTzi1foKI38oj0KOljEEujJBNwLw4OaSVQLlhyXI2dvMh2PMr9e J/OBWDh5P/FJLDut90qEJ9m8AGFtfMyb2vgSdKTGL2o2qDhE77AyiSjyjGAAFYOa nmO5Makl/3ZYweLQVOceXHdth5Vs/KRpm8O4543O4FrW9CB2QtZ59F1AbxEaDdvY rJc6T0BxA+B0UlQFpo/v0ZE38xE+innG8sy+OJUMNPo/TCG1tJmM2743XPlCKLdW zRXLmOrD21kRcS5YQL52Gl79fNCdrVmLAgMDZfDBOC3vf2qZNnnPwSYZN3QoiQ7V 5qsW5HzR1i64K6Wa27cz2IMPYHDFQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejiedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeejhfeftddugfdvjeekkeelveefhefgfeeuieeugedv ffeijefgueffvdefleduvdenucffohhmrghinhepphhshigtohhpghdrohhrghenucfkph epjeehrddujedvrddurdeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-1-69.tukw.qwest.net [75.172.1.69]) by mail.messagingengine.com (Postfix) with ESMTPA id 7573F1080069; Tue, 8 Dec 2020 09:44:57 -0500 (EST) Subject: Re: Executing on the connection? To: Denis Laxalde , psycopg@lists.postgresql.org References: <7171e07d-bb96-dfc6-47e9-351d85f4a973@dalibo.com> From: Adrian Klaver Message-ID: <7e10dc93-dd36-6494-9d7a-6cad3cecacdb@aklaver.com> Date: Tue, 8 Dec 2020 06:44:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <7171e07d-bb96-dfc6-47e9-351d85f4a973@dalibo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/8/20 5:51 AM, Denis Laxalde wrote: > Daniele Varrazzo a écrit : >> On Wed, 2 Dec 2020 at 11:20, Daniele Varrazzo >> wrote: >> >>> I'm toying with the idea of adding a 'connection.execute(query, >>> [params])' methd, which would basically just create a cursor >>> internally, query on it, and return it. No parameter could be passed >>> to the cursor() call, so it could only create the most standard, >>> client-side cursor (or whatever the default for the connection is, if >>> there is some form of cursor_factory, which hasn't been implemented in >>> psycopg3 yet). For anything more fancy, cursor() should be called >>> explicitly. >> >> This is what I've pushed earlier: >> >> https://www.psycopg.org/psycopg3/docs/connection.html#psycopg3.Connection.execute >> >> > > It did not strike me earlier, but it looks a bit weird to have > connection.execute() return a "cursor" to read results while this > "cursor" can also be used to execute commands. So, perhaps, another > object, with only the interface for result retrieval would be more > appropriate? Why? It is no different from now where you can reuse a cursor. > > Otherwise, that's a very nice addition, thanks! > > -- Adrian Klaver adrian.klaver@aklaver.com