mirror of
https://github.com/apache/superset.git
synced 2026-04-26 03:24:53 +00:00
fix: save columns reference from sqllab save datasets flow (#24248)
This commit is contained in:
@@ -22,6 +22,7 @@ from typing import Any, Optional
|
||||
import pytest
|
||||
from sqlalchemy import types
|
||||
|
||||
from superset.superset_typing import ResultSetColumnType, SQLAColumnType
|
||||
from superset.utils.core import GenericDataType
|
||||
from tests.unit_tests.db_engine_specs.utils import assert_column_spec
|
||||
|
||||
@@ -138,3 +139,32 @@ def test_get_column_spec(
|
||||
from superset.db_engine_specs.databricks import DatabricksNativeEngineSpec as spec
|
||||
|
||||
assert_column_spec(spec, native_type, sqla_type, attrs, generic_type, is_dttm)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cols, expected_result",
|
||||
[
|
||||
(
|
||||
[SQLAColumnType(name="John", type="integer", is_dttm=False)],
|
||||
[
|
||||
ResultSetColumnType(
|
||||
column_name="John", name="John", type="integer", is_dttm=False
|
||||
)
|
||||
],
|
||||
),
|
||||
(
|
||||
[SQLAColumnType(name="hugh", type="integer", is_dttm=False)],
|
||||
[
|
||||
ResultSetColumnType(
|
||||
column_name="hugh", name="hugh", type="integer", is_dttm=False
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_convert_inspector_columns(
|
||||
cols: list[SQLAColumnType], expected_result: list[ResultSetColumnType]
|
||||
):
|
||||
from superset.db_engine_specs.base import convert_inspector_columns
|
||||
|
||||
assert convert_inspector_columns(cols) == expected_result
|
||||
|
||||
Reference in New Issue
Block a user