Skip to content

Commit

Permalink
Fix SQLAlchemy URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
aalbu committed May 30, 2023
1 parent df0cc3e commit 985c999
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions tests/unit/sqlalchemy/test_dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,28 @@ def setup_method(self):
source="trino-sqlalchemy",
),
),
(
make_url(trino_url(
user="user",
host="localhost",
client_tags=["1", "sql"],
legacy_prepared_statements=False,
)),
'trino://user@localhost:8080/'
'?client_tags=%5B%221%22%2C+%22sql%22%5D'
'&legacy_prepared_statements=false'
'&source=trino-sqlalchemy',
list(),
dict(
host="localhost",
port=8080,
catalog="system",
user="user",
source="trino-sqlalchemy",
client_tags=["1", "sql"],
legacy_prepared_statements=False,
),
),
],
)
def test_create_connect_args(
Expand Down
2 changes: 1 addition & 1 deletion trino/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def create_connect_args(self, url: URL) -> Tuple[Sequence[Any], Mapping[str, Any
kwargs["legacy_primitive_types"] = json.loads(unquote_plus(url.query["legacy_primitive_types"]))

if "legacy_prepared_statements" in url.query:
kwargs["legacy_prepared_statements"] = unquote_plus(url.query["legacy_prepared_statements"])
kwargs["legacy_prepared_statements"] = json.loads(unquote_plus(url.query["legacy_prepared_statements"]))

if "verify" in url.query:
kwargs["verify"] = json.loads(unquote_plus(url.query["verify"]))
Expand Down

0 comments on commit 985c999

Please sign in to comment.