Skip to content

Commit adb4794

Browse files
aalbuhashhar
authored andcommitted
Fix SQLAlchemy URL parsing
1 parent cedffec commit adb4794

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tests/unit/sqlalchemy/test_dialect.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,28 @@ def setup_method(self):
199199
source="trino-sqlalchemy",
200200
),
201201
),
202+
(
203+
make_url(trino_url(
204+
user="user",
205+
host="localhost",
206+
client_tags=["1", "sql"],
207+
legacy_prepared_statements=False,
208+
)),
209+
'trino://user@localhost:8080/'
210+
'?client_tags=%5B%221%22%2C+%22sql%22%5D'
211+
'&legacy_prepared_statements=false'
212+
'&source=trino-sqlalchemy',
213+
list(),
214+
dict(
215+
host="localhost",
216+
port=8080,
217+
catalog="system",
218+
user="user",
219+
source="trino-sqlalchemy",
220+
client_tags=["1", "sql"],
221+
legacy_prepared_statements=False,
222+
),
223+
),
202224
],
203225
)
204226
def test_create_connect_args(

trino/sqlalchemy/dialect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def create_connect_args(self, url: URL) -> Tuple[Sequence[Any], Mapping[str, Any
129129
kwargs["legacy_primitive_types"] = json.loads(unquote_plus(url.query["legacy_primitive_types"]))
130130

131131
if "legacy_prepared_statements" in url.query:
132-
kwargs["legacy_prepared_statements"] = unquote_plus(url.query["legacy_prepared_statements"])
132+
kwargs["legacy_prepared_statements"] = json.loads(unquote_plus(url.query["legacy_prepared_statements"]))
133133

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

0 commit comments

Comments
 (0)