fix(Trino): create PrestoBaseEngineSpec base class to share common code between Trino and Presto (#21066)

* chore: create `PrestoBaseEngineSpec` class that share common functions between Presto and Trino

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* feat(Trino): support CertificateAuthentication

* chore(Presto): move `get_function_names` to `PrestoBaseEngineSpec`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* chores(Presto): remove `is_readonly_query`

* feat(Trino): implement `extra_table_metadata`

* feat(Trino): specify `User-Agent`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* fix: pylint

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* chores(Presto): move `PrestoBaseEngineSpec` to `presto.py`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* fix(Presto): typing annotations

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
This commit is contained in:
Đặng Minh Dũng
2022-08-29 14:21:28 +07:00
committed by GitHub
parent 5f76ac9001
commit ccb293a083
7 changed files with 233 additions and 205 deletions

View File

@@ -188,7 +188,7 @@ class TestDatabaseModel(SupersetTestCase):
call_args = mocked_create_engine.call_args
assert str(call_args[0][0]) == "trino://localhost"
assert call_args[1]["connect_args"] == {"user": "gamma"}
assert call_args[1]["connect_args"]["user"] == "gamma"
model = Database(
database_name="test_database",
@@ -203,7 +203,7 @@ class TestDatabaseModel(SupersetTestCase):
str(call_args[0][0])
== "trino://original_user:original_user_password@localhost"
)
assert call_args[1]["connect_args"] == {"user": "gamma"}
assert call_args[1]["connect_args"]["user"] == "gamma"
@mock.patch("superset.models.core.create_engine")
def test_impersonate_user_hive(self, mocked_create_engine):