Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gH61V-0005hR-22 for psycopg@arkaria.postgresql.org; Mon, 29 Oct 2018 11:47:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gH61T-0006Qs-3F for psycopg@arkaria.postgresql.org; Mon, 29 Oct 2018 11:47:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gH61S-0006Ql-Ub for psycopg@lists.postgresql.org; Mon, 29 Oct 2018 11:47:54 +0000 Received: from mail.dndg.it ([178.32.136.2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gH61R-0004MV-7d for psycopg@lists.postgresql.org; Mon, 29 Oct 2018 11:47:54 +0000 Received: from [10.94.33.108] (93-50-194-114.ip153.fastwebnet.it [93.50.194.114]) by mail.dndg.it (Postfix) with ESMTPSA id 77498A0271 for ; Mon, 29 Oct 2018 11:53:29 +0000 (UTC) Subject: Re: Feature branches merged to master for 2.8 release To: psycopg@lists.postgresql.org References: <1878453370.14916776.1539604797985@mail.yahoo.com> <62b46b76-ce7f-6b89-b5ad-d0f2c2533432@dndg.it> <1820701010.20861820.1540152265403@mail.yahoo.com> <1390677301.27162879.1540762541620@mail.yahoo.com> From: Federico Di Gregorio Organization: DNDG srl Message-ID: Date: Mon, 29 Oct 2018 12:47:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it-IT Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SURBL_BLOCKED, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/29/2018 11:49 AM, Daniele Varrazzo wrote: > On Sun, Oct 28, 2018 at 9:35 PM Christian Ferrari wrote: >> >> Dear All, >> today I have released LIXA 1.7.1 with Python/Psycopg2 support. >> To avoid two different methods (get_native_connection() for PostgreSQL and _get_native_connection() for MySQL/MariaDB) I have created a fork of Psycopg2 https://github.com/tiian/psycopg2/tree/get-native-connection with the code provided by Federico and method "get_native_connection" renamed. >> For the sake of convenience I have created a pull request: https://github.com/psycopg/psycopg2/pull/798 feel free to integrate it or to go on with the process you figured out in the past. >> Kind Regards >> Ch.F. > > I don't know what Federico had decided but I'd very much prefer the > name without underscore. Methods with underscore don't belong to an > object interface. Sorry for the late response, I was KO'ed by the flu. I agree with Daniele here but the fact that the *content* of the capsule, i.e., the PGconn* can change depending of the libpq version you're loading is pretty scary. I'd like to warn the client code (Python warnings to be suppressed? mm..) but just prepending an underscore to the method name doesn't mean much. If we add `get_native_connection()` then it becomes an official and supported psycopg extensions and doesn't make sense to mark it as private API. > There are always differences, in interfaces and in behaviour, between > dbapi drivers. A private method, returning two objects which are > different because they are very simply two database drivers, are not > the place where to start trying to unify interfaces. What you do, if > you want to deal with both drivers, is to write a wrapper unifying the > interfaces. I would be ok to adapt other drivers choices, if I agreed > with them, but I can't agree with an underscore method being > documented as part of the API: that's internal stuff and totally not > idiomatic Python. > > My vote goes to have this method name without underscore, but I'll > leave the final decision to Federico. Then without it is. federico -- Federico Di Gregorio federico.digregorio@dndg.it DNDG srl http://dndg.it Credo fermamente che da qualche parte, in una scatola ci sia un gatto che non è vivo ne morto. Credo anche che se i fisici non si sbrigano a dargli una scatoletta, ben presto sarà solo morto. -- adattato da una frase di Sam Black Crow