Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gB4Qz-0003eg-9e for psycopg@arkaria.postgresql.org; Fri, 12 Oct 2018 20:53:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gB4Qx-0007pl-Im for psycopg@arkaria.postgresql.org; Fri, 12 Oct 2018 20:53:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gB4Qx-0007pe-7t for psycopg@lists.postgresql.org; Fri, 12 Oct 2018 20:53:19 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gB4Qu-0004V6-AK for psycopg@postgresql.org; Fri, 12 Oct 2018 20:53:17 +0000 Received: by mail-ot1-x32e.google.com with SMTP id w67so13607492ota.7 for ; Fri, 12 Oct 2018 13:53:16 -0700 (PDT) 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=e057HfYi99nGBpxJjD+oxsi0po2Xn90LrSredZxb8dU=; b=T1sGdbPDwyDXVJxqkZv7NH69cypk5XKYW8GGaBBjrvwYudX7o5xrLbUr9s/zKYSjwr yCdD8k4oQFRO4anoeTyv3U4lJbZ5sTXonwAJ7xPJx91wQ0G4NjIpUgwqZL4M/stwtYuB jUOYjmhH1LkMiF4xUfIqRZeMyBkraaxdmq2HGJDTDnthPaTLpM2qk13OeoWIzU9ZHCfn C+QXnZW4Lsr5CsBq2dXF25yOXrERGxL4bzt34F23I/sP+8mZCAnbX/MelPgxntcFVFG4 46P+onuEOwkAvxNyl0q44tVX9PlEkypMoCWuhhZPV1IcWIns6ghzHKHnKpLqIUkrlGAW Fk8A== 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=e057HfYi99nGBpxJjD+oxsi0po2Xn90LrSredZxb8dU=; b=jrVRk6NliwBFBWS8XLxIK8ydFQBepALNZCzaXfdCJE4bLUGKz1pAwmgXUa4hi/9qJE +TYX38GOAcBPVS9oMF9CJonTo/ioSEHfoMbA9bSdV/5hSB5v8xEP9kTkWFYbjVfE3iXv hpEUCkE2BWTkeAYeGWSOxaOZwiSbOuHHWZWhKwcornsMtoF7Wjzji4sxVtsxYql7kdM1 6Z9T9iW7aDyUObRZ6MLhn9RP/04obmtdkHI91K1TQHjhuof1aVEdSVyQvVBvcKcmjrsq JcMscBBuCOAeuOKSz8zHHocgiXHXn7rHJ6vJ1Y51dxrwk3391gahzeU2wU3VdtIYYmcT otSw== X-Gm-Message-State: ABuFfojSYOH+6bxUWYf90SvT5B8iR5Za612UK8QHBpTiB4lNPWPMOsjL RLKqUWf2DqZfVmp1jTmHmZ1K9L+Yxv5eD4MvsAo= X-Google-Smtp-Source: ACcGV63K32709lmgHvYawz3Rnxi85cSGl1jT33oiNunqCt30H3IJ+Xz6dfja+NNczTkLI3mFf748JCeqMKvl6gh9Uf8= X-Received: by 2002:a9d:191f:: with SMTP id j31mr4649284ota.76.1539377595503; Fri, 12 Oct 2018 13:53:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marco De Paoli Date: Fri, 12 Oct 2018 22:53:04 +0200 Message-ID: Subject: Re: Adding an informative object to the connection To: Daniele Varrazzo Cc: psycopg@postgresql.org Content-Type: multipart/alternative; boundary="000000000000c15e1b05780e46fe" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000c15e1b05780e46fe Content-Type: text/plain; charset="UTF-8" Hi Daniele, Il giorno ven 12 ott 2018 alle ore 18:46 Daniele Varrazzo < daniele.varrazzo@gmail.com> ha scritto: > Hi, > > a few days ago we were contributed a merge request for an `.host` > attribute on the connection. But looking back at the bug > (https://github.com/psycopg/psycopg2/issues/726) I had already noticed > there are other interesting informative connection functions in the > libpq. Some of them are already exposed as methods of the connection > class (e.g. get_backend_pid(), get_transaction_status() etc), but I > can see a trickle of requests for others, so I'd rather expose > most/all of them. > > Instead of bloating the connection class with more and more attributes > and methods, I'm rather adding a connection.info method to retrieve > pgconn-specific information. The work is happening in this branch: > > https://github.com/psycopg/psycopg2/commits/connection-info > > I would softly deprecate the currently exposed informative methods: > not sending them away in a short time but giving a preference to use > from the 'info' object what belongs to the pgconn/libpq and to leave > on the connection things regarding the Python layer, and clean up the > interfaces a little bit. > > Any input is welcome. Cheers! > +1 good idea, clean and effective -- Marco --000000000000c15e1b05780e46fe Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Daniele,

Il giorno ven 12 ott 2018 alle ore 18:46 Daniele Varrazzo <daniele.varrazzo@gmail.com> h= a scritto:
Hi,

a few days ago we were contributed a merge request for an `.host`
attribute on the connection. But looking back at the bug
(https://github.com/psycopg/psycopg2/issues/726) I= had already noticed
there are other interesting informative connection functions in the
libpq. Some of them are already exposed as methods of the connection
class (e.g. get_backend_pid(), get_transaction_status() etc), but I
can see a trickle of requests for others, so I'd rather expose
most/all of them.

Instead of bloating the connection class with more and more attributes
and methods, I'm rather adding a connection.info method to retrieve pgconn-specific information. The work is happening in this branch:

https://github.com/psycopg/psycopg2/commi= ts/connection-info

I would softly deprecate the currently exposed informative methods:
not sending them away in a short time but giving a preference to use
from the 'info' object what belongs to the pgconn/libpq and to leav= e
on the connection things regarding the Python layer, and clean up the
interfaces a little bit.

Any input is welcome. Cheers!

+1
good idea, clean and effective

-- Marco
--000000000000c15e1b05780e46fe--