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 1gB0Zz-0000Pa-SS for psycopg@arkaria.postgresql.org; Fri, 12 Oct 2018 16:46:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gB0Zy-0007TR-7j for psycopg@arkaria.postgresql.org; Fri, 12 Oct 2018 16:46:22 +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 1gB0Zx-0007S8-Tb for psycopg@lists.postgresql.org; Fri, 12 Oct 2018 16:46:22 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gB0Zv-0007O0-5q for psycopg@postgresql.org; Fri, 12 Oct 2018 16:46:20 +0000 Received: by mail-lj1-x243.google.com with SMTP id p1-v6so11928235ljg.6 for ; Fri, 12 Oct 2018 09:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=9scXIAU9scNuv6iX65+e/Ldchg/jenE6mfuBk3uJymU=; b=rRN4gS93P94s9yTnskA6xE250tly5zSenE2dD4hjLEIgJuPHaOCrr3Npf3ULjCS33Y ZEgBt93U5Rj2O1B+NgJpk3uKz8pekOEUSRjjbtOdSSlArj3j63yqzo/e2L13flInlgZ6 0NsUfvNUHUb3X9wWvRKgIGAYd5addrimN+4umfiSPfRyH11LSlTf32MzPEATe5SV8NUw 9pfPRVOu+ncRyJeGmOaiU1iILxb06fqCVZnQBbhRaY+7uCP4odAbGnMTuMlvlWgkq1fV yOmr+0vuaEviRG2mMeui1CHzTzF/17eUiaF0MQwltwJP3tTf+N84uz/NWjcSpRKGGwrk s2WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=9scXIAU9scNuv6iX65+e/Ldchg/jenE6mfuBk3uJymU=; b=qjgghv6yD1qW+l/ZRaM09gLp3gbabtdD5uJSC6YZo3Tl46B48WTMPl1MIvE9Zg6Px1 QoP84swfFH6icJmc0hCvnzwtkOwFFw+t+qY2oL+0hTJy0r80vJwvGAoa9rw7gogy3u2G RrPFInCp+kUPHK4G6+A+5Uu7PY7WpBYzBiPjv7c/ZNPWbYPWDgEOBADETVg9v6rYZynD 6u/+Vnt8zHfyQA0So7RByMcX+9fP08fhE4Zymp4wXqLixtb3udPCdHKiMUIc/ShKh4Hv ockHJjotXgESGY0RsnuXABI3U3eMB0jn/6aFWzM0GT5ZBRcjW/MTmyPNLLT29xPo1Xp/ ChgQ== X-Gm-Message-State: ABuFfogeZ5tLVqZoJS2CavjO/fj7tMgBkuiWxkzqIj0Rrnw0FBwPiM8t yf3vFyOTF8hDm1a1sL4wBKG5p7dZ1k/1+dZ9QvUdk4+Q X-Google-Smtp-Source: ACcGV62bM499CjbxQtfpEuMpRZq4jUlP6MiWJbRrgEGMVRzmxEmSgcCo03hJ8/GRsUW35IUIVgihhgElw9zYmlmPqpw= X-Received: by 2002:a2e:3101:: with SMTP id x1-v6mr4536271ljx.83.1539362776981; Fri, 12 Oct 2018 09:46:16 -0700 (PDT) MIME-Version: 1.0 From: Daniele Varrazzo Date: Fri, 12 Oct 2018 17:46:05 +0100 Message-ID: Subject: Adding an informative object to the connection To: psycopg@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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! -- Daniele