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 1maeBy-0000Gm-SZ for psycopg@arkaria.postgresql.org; Wed, 13 Oct 2021 13:21:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1maeBx-0003ZD-Nv for psycopg@arkaria.postgresql.org; Wed, 13 Oct 2021 13:21:09 +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 1maeBx-0003Z5-IS for psycopg@lists.postgresql.org; Wed, 13 Oct 2021 13:21:09 +0000 Received: from dormouse.elm.relay.mailchannels.net ([23.83.212.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maeBs-0007fS-Vk for psycopg@postgresql.org; Wed, 13 Oct 2021 13:21:09 +0000 X-Sender-Id: cp7oy65bvo|x-authuser|paolo@paolodestefani.it Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6C0002E0EE6; Wed, 13 Oct 2021 13:21:00 +0000 (UTC) Received: from lu-shared04.cpanelplatform.com (unknown [127.0.0.6]) (Authenticated sender: cp7oy65bvo) by relay.mailchannels.net (Postfix) with ESMTPA id 2CD152E159E; Wed, 13 Oct 2021 13:20:57 +0000 (UTC) X-Sender-Id: cp7oy65bvo|x-authuser|paolo@paolodestefani.it Received: from lu-shared04.cpanelplatform.com ([UNAVAILABLE]. [107.189.4.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.123.194.20 (trex/6.4.3); Wed, 13 Oct 2021 13:21:00 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: cp7oy65bvo|x-authuser|paolo@paolodestefani.it X-MailChannels-Auth-Id: cp7oy65bvo X-Cooing-Blushing: 56e4304f4bf1ed7b_1634131260134_2274901076 X-MC-Loop-Signature: 1634131260134:2442980897 X-MC-Ingress-Time: 1634131260134 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=paolodestefani.it; s=default; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iCGGYnoMlWFihsCgUtemC2kJEzIhIpx13ZtcLJPnHyk=; b=Vsg9mjGAPkOzKx91sXkeG1Y/Nd aODJX4tuhhV8O4WmSMi1gMAoDCgbqtB0fzDJxn3IRBORbGahousOKahqoY4Zp4zd20c+ufrJJrEfY jEv7Lrqnb3c93VstfSRpJCjbl7XGcUjhDSIoO0ke1/FvexRRUTQQqs6BNK0pzWpJOc0oOui1mKebo EZcwn4buUrzISMSJi6mamuZtWRfgSxjfNqHBgzYF+2PmttMGfsJVm3zEpOlqsnF/DO1Asiv6VGEc+ 8TiwFEgKJonk7cN9O2XTuhFCPuhtVw4MQPUPV+mECn1XrrLbqoXz0skTWJlCTkRBcon/xE8W8UHNh QgJe57tQ==; Received: from [::1] (port=36832 helo=lu-shared04.cpanelplatform.com) by lu-shared04.cpanelplatform.com with esmtpa (Exim 4.94.2) (envelope-from ) id 1maeBi-007ynb-In; Wed, 13 Oct 2021 15:20:54 +0200 MIME-Version: 1.0 Date: Wed, 13 Oct 2021 15:20:54 +0200 From: Paolo De Stefani To: Daniele Varrazzo Cc: Psycopg Subject: Re: psycopg3 transactions In-Reply-To: References: <9a99d2d110b121542d1ea0a05066858b@paolodestefani.it> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <6683df3e65fe961aa478e61db7ad687d@paolodestefani.it> X-Sender: paolo@paolodestefani.it Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-AuthUser: paolo@paolodestefani.it List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Il 13/10/2021 13:50 Daniele Varrazzo ha scritto: > > I think we can improve the documentation there by extending more about > the effects of the interaction between DBAPI transactions and the > transaction() blocks. And things are definitely more intuitive if > transaction() is used in autocommit: we might want to advise people to > do that. > > Suggestions are welcome. > > -- Daniele I think the problem is only for people like me that come from psycopg2. I was used to wrote a "with con.cursor() as cur:" that now i hato to replace with: with con.transaction(): with con.cursor() as cur: cur.execute("ANY SQL STATEMENT") and everything works as expected (or i expect...) Thanks for clarifying -- Paolo De Stefani