Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ def normalize_custom_sql_metric(cls, expression: str) -> str:
types.SmallInteger(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^tinyint", re.IGNORECASE),
types.SmallInteger(),
GenericDataType.NUMERIC,
),
(
re.compile(r"^int(eger)?", re.IGNORECASE),
types.Integer(),
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/db_engine_specs/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def test_cte_query_parsing(original: types.TypeEngine, expected: str) -> None:
"native_type,sqla_type,attrs,generic_type,is_dttm",
[
("SMALLINT", types.SmallInteger, None, GenericDataType.NUMERIC, False),
("TINYINT", types.SmallInteger, None, GenericDataType.NUMERIC, False),
("INTEGER", types.Integer, None, GenericDataType.NUMERIC, False),
("BIGINT", types.BigInteger, None, GenericDataType.NUMERIC, False),
("DECIMAL", types.Numeric, None, GenericDataType.NUMERIC, False),
Expand Down
7 changes: 1 addition & 6 deletions tests/unit_tests/db_engine_specs/test_duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_column_type_recognition() -> None:
"INTEGER",
"BIGINT",
"SMALLINT",
"TINYINT",
# DuckDB-specific unsigned types
"HUGEINT",
"UBIGINT",
Expand All @@ -158,12 +159,6 @@ def test_column_type_recognition() -> None:
f"got {col_spec.generic_type}"
)

# Test that TINYINT (non-unsigned) is also recognized
# Note: TINYINT is not in the default mappings, but should be handled
col_spec = DuckDBEngineSpec.get_column_spec("TINYINT")
# TINYINT matches the pattern "^int" so it should be recognized
assert col_spec is None, "TINYINT doesn't match any patterns"


def test_motherduck_impersonation(mocker: MockerFixture) -> None:
"""
Expand Down
Loading