From f34d6a03f94208148d977f1639a7f31f77bcff71 Mon Sep 17 00:00:00 2001 From: matt-fleming Date: Mon, 20 Mar 2023 16:27:59 +0000 Subject: [PATCH] Changed sqla client to add query params as string --- src/tentaclio/clients/sqla_client.py | 2 ++ src/tentaclio/urls.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/tentaclio/clients/sqla_client.py b/src/tentaclio/clients/sqla_client.py index 6cd00d63..c52d9686 100644 --- a/src/tentaclio/clients/sqla_client.py +++ b/src/tentaclio/clients/sqla_client.py @@ -96,6 +96,8 @@ def _connect(self) -> Connection: port=self.port, database=self.database, ) + if self.url.query_string: + parsed_url.update_query_string(self.url.query_string) if self.engine is None: self.engine = create_engine( parsed_url, diff --git a/src/tentaclio/urls.py b/src/tentaclio/urls.py index 5539f3f0..86735689 100644 --- a/src/tentaclio/urls.py +++ b/src/tentaclio/urls.py @@ -38,6 +38,7 @@ class URL: _port: Optional[int] = None _path: str _query: Optional[Dict[str, str]] = None + _query_string: Optional[str] = None def __init__(self, url: str) -> None: """Create a url by parsing the parametre.""" @@ -57,6 +58,7 @@ def _parse_url(self) -> None: self._hostname = parsed_url.hostname self._port = parsed_url.port self._path = parsed_url.path + self._query_string = parsed_url.query # Replace %xx escapes - ONLY for username & password if parsed_url.username and self._username: @@ -168,6 +170,11 @@ def query(self) -> Optional[Dict[str, str]]: """Access the query.""" return self._query + @property + def query_string(self) -> Optional[str]: + """Access the query string.""" + return self._query_string + @property def url(self) -> str: """Return the original url."""