PostgreSQL: allow connection parameters to be specified (#7579)

As documented in
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS

Multiple parameters are separated by a space.
This commit is contained in:
Eric Radman
2025-11-26 09:32:11 -05:00
committed by GitHub
parent b5781a8ebe
commit 9d49e0457f
2 changed files with 23 additions and 1 deletions

View File

@@ -1,6 +1,16 @@
from unittest import TestCase
from redash.query_runner.pg import build_schema
from redash.query_runner.pg import _parse_dsn, build_schema
class TestParameters(TestCase):
def test_parse_dsn(self):
configuration = {"dsn": "application_name=redash connect_timeout=5"}
self.assertDictEqual(_parse_dsn(configuration), {"application_name": "redash", "connect_timeout": "5"})
def test_parse_dsn_not_permitted(self):
configuration = {"dsn": "password=xyz"}
self.assertRaises(ValueError, _parse_dsn, configuration)
class TestBuildSchema(TestCase):