From 285e62559e81f3a106426d54850755bee0f53bd9 Mon Sep 17 00:00:00 2001 From: Anna Glasgall Date: Thu, 27 Oct 2022 20:40:19 -0400 Subject: [PATCH] magic: use pgcli.connect_uri instead of connect (#1375) This makes %pgcli work even if you use non-password (e.g. TLS cert) authentication --- AUTHORS | 1 + changelog.rst | 1 + pgcli/magic.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 50f31bb6..c6751de7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -124,6 +124,7 @@ Contributors: * Kian-Meng Ang (kianmeng) * Liu Zhao (astroshot) * Rigo Neri (rigoneri) + * Anna Glasgall (annathyst) Creator: -------- diff --git a/changelog.rst b/changelog.rst index 1219c3c3..88b13419 100644 --- a/changelog.rst +++ b/changelog.rst @@ -7,6 +7,7 @@ Features: * Changed the `destructive_warning` config to be a list of commands that are considered destructive. This would allow you to be warned on `create`, `grant`, or `insert` queries. * Destructive warnings will now include the alias dsn connection string name if provided (-D option). +* pgcli.magic will now work with connection URLs that use TLS client certificates for authentication 3.5.0 (2022/09/15): =================== diff --git a/pgcli/magic.py b/pgcli/magic.py index 6e58f28b..09902a29 100644 --- a/pgcli/magic.py +++ b/pgcli/magic.py @@ -43,7 +43,7 @@ def pgcli_line_magic(line): u = conn.session.engine.url _logger.debug("New pgcli: %r", str(u)) - pgcli.connect(u.database, u.host, u.username, u.port, u.password) + pgcli.connect_uri(str(u._replace(drivername="postgres"))) conn._pgcli = pgcli # For convenience, print the connection alias