{"record":{"id":"2363b7d8ce42901b","repo":"apache/superset","slug":"unknown-type-native-type","errorCode":null,"errorMessage":"Unknown type: {native_type}","messagePattern":"Unknown type: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":500,"severity":"error","filePath":"superset/commands/dataset/importers/v1/utils.py","lineNumber":109,"sourceCode":"    \"FLOAT\": Float(),\n    \"FLOAT64\": Float(),\n    \"DOUBLE PRECISION\": Float(),\n    \"DATE\": Date(),\n    \"DATETIME\": DateTime(),\n    \"TIMESTAMP WITHOUT TIME ZONE\": DateTime(timezone=False),\n    \"TIMESTAMP WITH TIME ZONE\": DateTime(timezone=True),\n}\n\n\ndef get_sqla_type(native_type: str) -> TypeEngine:\n    if native_type.upper() in type_map:\n        return type_map[native_type.upper()]\n\n    if match := VARCHAR.match(native_type):\n        size = int(match.group(1))\n        return String(size)\n\n    raise Exception(  # pylint: disable=broad-exception-raised\n        f\"Unknown type: {native_type}\"\n    )\n\n\ndef get_dtype(df: pd.DataFrame, dataset: SqlaTable) -> dict[str, TypeEngine]:\n    return {\n        column.column_name: get_sqla_type(column.type)\n        for column in dataset.columns\n        if column.column_name in df.keys()\n    }\n\n\ndef validate_data_uri(data_uri: str) -> None:\n    \"\"\"\n    Validate that the data URI is permitted for dataset import.\n\n    Local ``file://`` URIs are allowed only when the path is confined to the\n    bundled examples folder.  All other URIs must match a pattern in","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/importers/v1/utils.py#L91-L127","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before (YAML column)\n- column_name: payload\n  type: JSONB\n# after\n- column_name: payload\n  type: TEXT","handlingStrategy":"validation","validationCode":"import re\nfrom superset.commands.dataset.importers.v1.utils import get_sqla_type\n\ndef check_types(config):\n    bad = []\n    for col in config.get('columns', []):\n        t = col.get('type', '')\n        try:\n            get_sqla_type(t)\n        except Exception:\n            if not re.match(r'^VARCHAR\\((\\d+)\\)$', t.upper()):\n                bad.append((col.get('column_name'), t))\n    return bad\n\nbad = check_types(config)\nassert not bad, f'untranslatable column types: {bad}'","typeGuard":"def has_known_types(config: dict) -> bool:\n    return not check_types(config)","tryCatchPattern":"try:\n    import_dataset(config)\nexcept Exception as ex:\n    if str(ex).startswith('Unknown type:'):\n        native = str(ex).split(':', 1)[1].strip()\n        # map native -> generic (e.g. JSONB -> TEXT) in the config and retry once\n        ...","preventionTips":["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"],"tags":["dataset-import","type-mapping","sqlalchemy","superset"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}