From 4fa7619b1f9a16f01c87bc26e8606bc5b0b435ec Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Tue, 21 May 2024 11:23:32 -0700 Subject: [PATCH] fix: revert fix(presto preview): re-enable schema previsualization for Trino/Presto table/schemas" (#28613) --- superset/db_engine_specs/presto.py | 5 +---- tests/unit_tests/db_engine_specs/test_presto.py | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/superset/db_engine_specs/presto.py b/superset/db_engine_specs/presto.py index ba542b8f6..d97264e00 100644 --- a/superset/db_engine_specs/presto.py +++ b/superset/db_engine_specs/presto.py @@ -536,10 +536,7 @@ class PrestoBaseEngineSpec(BaseEngineSpec, metaclass=ABCMeta): } for col_name, value in zip(col_names, values): - col_type = None - if col_type_name := column_type_by_name.get(col_name): - if col_type_class := getattr(types, col_type_name, None): - col_type = col_type_class() + col_type = column_type_by_name.get(col_name) if isinstance(col_type, types.DATE): col_type = Date() diff --git a/tests/unit_tests/db_engine_specs/test_presto.py b/tests/unit_tests/db_engine_specs/test_presto.py index f9680006d..e00210222 100644 --- a/tests/unit_tests/db_engine_specs/test_presto.py +++ b/tests/unit_tests/db_engine_specs/test_presto.py @@ -116,10 +116,10 @@ def test_get_schema_from_engine_params() -> None: @pytest.mark.parametrize( ["column_type", "column_value", "expected_value"], [ - ("DATE", "2023-05-01", "DATE '2023-05-01'"), - ("TIMESTAMP", "2023-05-01", "TIMESTAMP '2023-05-01'"), - ("VARCHAR", "2023-05-01", "'2023-05-01'"), - ("INT", 1234, "1234"), + (types.DATE(), "2023-05-01", "DATE '2023-05-01'"), + (types.TIMESTAMP(), "2023-05-01", "TIMESTAMP '2023-05-01'"), + (types.VARCHAR(), "2023-05-01", "'2023-05-01'"), + (types.INT(), 1234, "1234"), ], ) def test_where_latest_partition(