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 1kkTeV-0006yX-Hl for psycopg@arkaria.postgresql.org; Wed, 02 Dec 2020 15:02:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkTeU-00065n-8z for psycopg@arkaria.postgresql.org; Wed, 02 Dec 2020 15:02:42 +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 1kkTeT-00065f-C1 for psycopg@lists.postgresql.org; Wed, 02 Dec 2020 15:02:42 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkTeL-0003CU-Ls for psycopg@postgresql.org; Wed, 02 Dec 2020 15:02:40 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 6A755EB4; Wed, 2 Dec 2020 10:02:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 02 Dec 2020 10:02:30 -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=V RkhN5veEjcRyqQG7Viv13dzmer8Wc4ybEGwPtr1U4s=; b=RTC50xEchptuSt9GZ R/UuKAgalf2vRkd3c4WFjI6v2GZ+9vzfhk0gU4pbX1JSK+fveMZW/4QVXLLlxqHG cT1RyJHw/5rEZgzEo/2xAhTHzzaaebKgA29gLrB8YqySSmYAdRg6YwcoLJ2B5SSR 2Cit4Gku1pJNErEWXPwxJ0zUuDWHyeJRqh0dpTQmIGaI/KjwWWQ/yR4T4PEjeTPC LfpskvqgzLnUriPI0rFbUcgbBVNXBU3HZC+BBT1lx92nU5yFbmB2cUsCNUgCpRYL GnABGwHSXn34mBVt0tOUPtjXqAdrEG3V2RLgHhGUHFKRwhw70UyiaYOu8jR022SX nLqnw== 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=VRkhN5veEjcRyqQG7Viv13dzmer8Wc4ybEGwPtr1U 4s=; b=h1+BuQg/XbRVk3ME2r4nzSGNHmXJcXQc33YRVhMTl6r4ziShJy7qkVucs 2uGZE/1nB6QllDJhmAE1KDohDkx445WFjVy9t4XWCheJ106zaXK0GBCwQFiFimIf BvO8qkdWf/fQtvVCUV7NHVrYywdJ9ghWgL09siL9JNSi1e91TiiR6Xntz3oxGnA3 f6c5dsoQGMJETEjp0AGwh9CaY4GTCt/+HeoxmdsM/URr6kgecLF0fM9JrdlWrOsP +o2RmnMR3vfMspNktITHDszhtHm7eYmH7htEn2Q0RXFAYq2uxyX79ziBzKIcLOQp 7m7u0/MVxNf+zjPjlYGs+jMT0iAsA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeigedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeetjedvteffjeeuvdelieeffeehuedthffgvdfhhffh kedvudevgedvjedufefgveenucfkphepjeehrddujedvrddurdeileenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhm 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 38D48108005C; Wed, 2 Dec 2020 10:02:29 -0500 (EST) Subject: Re: Executing on the connection? To: Daniele Varrazzo , psycopg@postgresql.org References: From: Adrian Klaver Message-ID: Date: Wed, 2 Dec 2020 07:02:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/2/20 3:20 AM, Daniele Varrazzo wrote: > Hello, > > > As a result people could use: > > conn = psycopg3.connect(dsn) > record = conn.execute(query, params).fetchone() > # or > for record in conn.execute(query, params): > ... # do something That is what the sqlite3 module does and I find it handy. > > No other methods bloating the connection interface: no executemany(), > copy(), callproc (actually there will be no callproc at all in Just to be clear the above(callproc excepted) or some variation of it will still be available off the cursor interface, correct? > psycopg3: postgres has no fast path for function call and too much > semantics around stored procedure that a single callproc() couldn't > cover). > > Being the cursor client-side, its close() doesn't actually do anythin > apart from making it unusable, so just disposing of it without calling > close() is totally safe. > > Thoughts? > > Cheers! > > -- Daniele > > -- Adrian Klaver adrian.klaver@aklaver.com