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 1l7g95-0007QY-T7 for psycopg@arkaria.postgresql.org; Thu, 04 Feb 2021 15:02:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l7g94-0002DQ-Ie for psycopg@arkaria.postgresql.org; Thu, 04 Feb 2021 15:02:10 +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 1l7g94-0002DJ-8R for psycopg@lists.postgresql.org; Thu, 04 Feb 2021 15:02:10 +0000 Received: from mail1.dalibo.net ([212.83.143.11] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7g91-0005B9-Uh for psycopg@postgresql.org; Thu, 04 Feb 2021 15:02:09 +0000 Received: from dalibo.com (lan31-5-82-234-69-236.fbx.proxad.net [82.234.69.236]) by mail.dalibo.com (Postfix) with ESMTPSA id D5EC5204A1; Thu, 4 Feb 2021 16:02:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1612450925; bh=Qwt3whgdPpz44cO0xMPNgCb2V2/NAfKbk9Jspnpj4L4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Tbbuh0oFIYopb8MUkttY5XJQ0sq3MDJ9nYkLz5CUOmWjGGS/A63Q99NDHh5kf1SSp sK7nq9PWRnyubSjAIiKnG2m5IpuGJOakoQJ4s4Wx0cEeWx0if6B7iZAogTWNu94pOx QYD5RmAC6TjHyVvNet8V6BoyNC7X9uH99ilz+Dgk= Date: Thu, 4 Feb 2021 16:02:03 +0100 From: Denis Laxalde To: Christophe Pettus Cc: Daniele Varrazzo , psycopg@postgresql.org Subject: Re: about client-side cursors Message-ID: <20210204150203.iuophq3yx7nzpfzo@dalibo.com> References: <20210203161548.vkhu3qkpvmgvyhik@dalibo.com> <20210204111647.4s3qie5cnassksa5@dalibo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Christophe Pettus a écrit : > > On Feb 4, 2021, at 03:16, Denis Laxalde wrote: > > But, unless I missed it, the PEP does not state how to implement query > > execution and result fetch operations if the database does not need a > > cursor. > > First, any change like this would have to maintain their current API > essentially forever, unless psycopg3 represents a completely > incompatible break with the psycopg2 interface. There is an enormous > body of code out there that uses the current cursor() interface for > client-side cursors. Sure, that's a valid point. But maintaining this backwards compatibility does not mean we can't hide the details and advertise a cleaner API for newcomers or people willing to migrate. > Second, it would be very unwise to make guarantees about when these > operations interact with the database. I think that any client > application should expect that both cursor.execute() and > cursor.fetchone()/.fetchall() are asynchronous operations, and code > appropriately. If "cursor" is a real database cursor, I agree.