This repository has been archived by the owner on May 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support connection parameter sessionUser
- Loading branch information
Ke Zhu
committed
Sep 2, 2021
1 parent
8045f49
commit 68e6f58
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from sqlalchemy.engine import url | ||
from sqlalchemy_trino.dialect import TrinoDialect | ||
|
||
|
||
def test_trino_connection_string_user(): | ||
dialect = TrinoDialect() | ||
username = 'test-user' | ||
u = url.make_url(f'trino://{username}@host') | ||
_, cparams = dialect.create_connect_args(u) | ||
|
||
assert cparams['user'] == username | ||
|
||
|
||
def test_trino_connection_string_session_user(): | ||
dialect = TrinoDialect() | ||
username = 'test-user' | ||
session_user = 'sess-user' | ||
u = url.make_url(f'trino://{username}@host/?sessionUser={session_user}') | ||
_, cparams = dialect.create_connect_args(u) | ||
|
||
assert cparams['user'] == session_user |