summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2023-01-02 15:15:21 -0800
committerGitHub <noreply@github.com>2023-01-02 15:15:21 -0800
commit81b0431d80f84ecf86bd311c7e06afe291b965fd (patch)
tree42a3746a7feac765a8cb8ca70c9938c861cb7428
parent2db54f14aae65e2639d1392fc4154964fb762d4e (diff)
parent7a4086c7c0a49226504c474640bd9375f3f9062b (diff)
Merge pull request #1390 from dbcli/j-bennet/1373-fix-dsn
Fix connecting with dsn.
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--changelog.rst7
-rw-r--r--pgcli/pgexecute.py6
3 files changed, 12 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 25f84df7..2f02fc2d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,7 +72,7 @@ jobs:
pip install keyrings.alt>=3.1
- name: Run unit tests
- run: coverage run --source pgcli -m py.test
+ run: coverage run --source pgcli -m pytest
- name: Run integration tests
env:
diff --git a/changelog.rst b/changelog.rst
index 24c5b577..0563a7b7 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -4,7 +4,7 @@ Upcoming
Features:
---------
-* Changed the `destructive_warning` config to be a list of commands that are considered
+* 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
@@ -12,7 +12,12 @@ Features:
Also prevents getting stuck in a retry loop.
* Config option to not restart connection when cancelling a `destructive_warning` query. By default,
it will now not restart.
+
+Bug fixes:
+----------
+
* Fix \ev not producing a correctly quoted "schema"."view"
+* Fix 'invalid connection option "dsn"' ([issue 1373](https://github.com/dbcli/pgcli/issues/1373)).
3.5.0 (2022/09/15):
===================
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py
index 9dae9c78..31a9113d 100644
--- a/pgcli/pgexecute.py
+++ b/pgcli/pgexecute.py
@@ -203,7 +203,11 @@ class PGExecute:
conn_params.update({k: v for k, v in new_params.items() if v})
- conn_info = make_conninfo(**conn_params)
+ if "dsn" in conn_params:
+ other_params = {k: v for k, v in conn_params.items() if k != "dsn"}
+ conn_info = make_conninfo(conn_params["dsn"], **other_params)
+ else:
+ conn_info = make_conninfo(**conn_params)
conn = psycopg.connect(conn_info)
conn.cursor_factory = ProtocolSafeCursor