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 1kmePp-0001RA-4M for psycopg@arkaria.postgresql.org; Tue, 08 Dec 2020 14:56:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kmePm-0006o9-DV for psycopg@arkaria.postgresql.org; Tue, 08 Dec 2020 14:56:30 +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 1kmePm-0006o1-8R for psycopg@lists.postgresql.org; Tue, 08 Dec 2020 14:56:30 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kmePk-00087j-3Q for psycopg@lists.postgresql.org; Tue, 08 Dec 2020 14:56:29 +0000 Received: by mail-lf1-x129.google.com with SMTP id a9so23752664lfh.2 for ; Tue, 08 Dec 2020 06:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Aqv2of05Xd6OIVS1pgDBn1mFmewTWbHG5Zr1odG5UR4=; b=iNTC+Yw33/wVh9N7G6553iUEBXFIztuRr/2DeKPloW1QjJth7biHxt5M3teAG9Dc5Q VxOGYr4W34GKNMSi5laTafLwxgXzM2meoXkOf1lTd+JlF22KASH/h9R2L+X85ycloIfx F2PcBBd6kWdAsiaSzHA7hA43ArbwSNn40wpMOAXaCBzZwLIjIvELXRF65cb6H10Rzv2E wcmBy3MKMuB/U8SuKxTm6cAm5UbbxEsmO6A1mWf2dAODPv/IFrHvibggtJGvTbYdIwxU M4zZzwlSBsS/QpDQjcD465vVhpVcUv7dRDj8rcO/UME4UcHdcWhQOc2QeCClGEeK2eki tL5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Aqv2of05Xd6OIVS1pgDBn1mFmewTWbHG5Zr1odG5UR4=; b=YVUmuQuJSvwds2E/AytD4TxMrHMF+WxD15Ot5X+1b/hg++CEhIzi/RbtAPsvBDVYMw 4FHu5Zc8Qopv8F1EwfvK5hcxVeZ0GzYxSRCCfeWBDBYRwZ9hUKJLK7Ye0ktdfXCc8xc6 5uENLAk+c0RAMqk9URVMdWXj/aVScmNk2SNrqrsXZqWQB2ISv/8Gwpq/wnt4inw4irY3 o2OIop46JzLe/+WuMT7GFwOfd9E8KC59JQb8rrjAks9I0sJzacAO43lHkfduGtKP6IFJ Esyxmtdh9qI1O/ynjCSs+upIpjibEfFKB3Ic3tYS/47rpm11uHcWs045A8NItPS3KHYI WmTQ== X-Gm-Message-State: AOAM533VFXLpnKF1N75a0g0fyFBUCyEM4POB+7XlXBWLorLElqQwJjDe nLlVdmEvlJjd44qoXCVA02WxneIwPJawHWMosDBuYEVgqLI= X-Google-Smtp-Source: ABdhPJyom13CI01TWjtxSaRdZJtBulRjdgrRMABYhitS6EV6YkHlASzUvr+MhPYnXbJl76btST3WPM4ppSPq8MTgSt8= X-Received: by 2002:ac2:5619:: with SMTP id v25mr10291638lfd.102.1607439386467; Tue, 08 Dec 2020 06:56:26 -0800 (PST) MIME-Version: 1.0 References: <7171e07d-bb96-dfc6-47e9-351d85f4a973@dalibo.com> In-Reply-To: <7171e07d-bb96-dfc6-47e9-351d85f4a973@dalibo.com> From: Daniele Varrazzo Date: Tue, 8 Dec 2020 14:56:14 +0000 Message-ID: Subject: Re: Executing on the connection? To: Denis Laxalde Cc: psycopg@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 8 Dec 2020 at 13:51, Denis Laxalde wrote: > 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? It thought about that, and it would be weird if people used a cursor for further queries after consuming it, yes. But hey, who are we to deny them to do that? :D I wouldn't go about creating and maintaining new objects and interfaces only to limit the possibility. My idea is that those who are interested in using `conn.execute()` are exactly the people who don't care about having execute() on a cursor. I think there's no harm in leaving it there :) -- Daniele