apache/superset · error · Exception
Unknown type: {native_type}
Error message
Unknown type: {native_type} What it means
get_sqla_type maps a native type string from an imported dataset's column metadata to a SQLAlchemy type using a fixed type_map plus a VARCHAR(n) regex. When the string matches neither, it raises a bare Exception('Unknown type: ...'). This runs during import when the dataset declares a column type the importer cannot translate (used e.g. by get_dtype for dataframe loading).
Source
Thrown at superset/commands/dataset/importers/v1/utils.py:109
"FLOAT": Float(),
"FLOAT64": Float(),
"DOUBLE PRECISION": Float(),
"DATE": Date(),
"DATETIME": DateTime(),
"TIMESTAMP WITHOUT TIME ZONE": DateTime(timezone=False),
"TIMESTAMP WITH TIME ZONE": DateTime(timezone=True),
}
def get_sqla_type(native_type: str) -> TypeEngine:
if native_type.upper() in type_map:
return type_map[native_type.upper()]
if match := VARCHAR.match(native_type):
size = int(match.group(1))
return String(size)
raise Exception( # pylint: disable=broad-exception-raised
f"Unknown type: {native_type}"
)
def get_dtype(df: pd.DataFrame, dataset: SqlaTable) -> dict[str, TypeEngine]:
return {
column.column_name: get_sqla_type(column.type)
for column in dataset.columns
if column.column_name in df.keys()
}
def validate_data_uri(data_uri: str) -> None:
"""
Validate that the data URI is permitted for dataset import.
Local ``file://`` URIs are allowed only when the path is confined to the
bundled examples folder. All other URIs must match a pattern inView on GitHub (pinned to f4587218dd)
Solutions
- Edit the dataset YAML and change the offending column's 'type' to a known generic type (STRING, TEXT, INTEGER, TIMESTAMP WITH TIME ZONE, or VARCHAR(n)) before importing
- Upgrade Superset to a version whose type_map includes the native type
- If the type is legitimately needed, add it to type_map via a fork/patch and contribute it upstream
Example fix
# before (YAML column) - column_name: payload type: JSONB # after - column_name: payload type: TEXT
Defensive patterns
Strategy: validation
Validate before calling
import re
from superset.commands.dataset.importers.v1.utils import get_sqla_type
def check_types(config):
bad = []
for col in config.get('columns', []):
t = col.get('type', '')
try:
get_sqla_type(t)
except Exception:
if not re.match(r'^VARCHAR\((\d+)\)$', t.upper()):
bad.append((col.get('column_name'), t))
return bad
bad = check_types(config)
assert not bad, f'untranslatable column types: {bad}' Type guard
def has_known_types(config: dict) -> bool:
return not check_types(config) Try / catch
try:
import_dataset(config)
except Exception as ex:
if str(ex).startswith('Unknown type:'):
native = str(ex).split(':', 1)[1].strip()
# map native -> generic (e.g. JSONB -> TEXT) in the config and retry once
... Prevention
- Pre-flight column types against get_sqla_type before import
- Prefer generic type names (STRING/INTEGER/TIMESTAMP) in hand-authored bundles
- Upgrade Superset when importing bundles from newer engines
When it happens
Trigger: Importing a dataset YAML whose column 'type' field is a native type not present in type_map (e.g. engine-specific types like 'JSONB', 'MONEY', 'ENUM(...)') and not matching the VARCHAR(n) pattern; or a typo'd/empty type string.
Common situations: Bundles exported from an engine whose type names are not in the map, hand-edited YAML with a wrong type string, or version drift where a newly supported source type is not yet in this Superset version's type_map.
Related errors
- {file_name} has no valid keys
- {file_name} is not a valid file
- ; ".join(str(message) for message in ex.messages)
- Data URI is not allowed.
- Only the default catalog is supported for this connection
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/2363b7d8ce42901b.
Report an issue: GitHub.