{"record":{"id":"e0907037c85a7d90","repo":"apache/superset","slug":"only-the-default-catalog-is-supported-for-this-con","errorCode":null,"errorMessage":"Only the default catalog is supported for this connection","messagePattern":"Only the default catalog is supported for this connection","errorType":"validation","errorClass":"MultiCatalogDisabledValidationError","httpStatus":422,"severity":"error","filePath":"superset/commands/dataset/importers/v1/utils.py","lineNumber":198,"sourceCode":"    \"\"\"\n    catalog = config.get(\"catalog\")\n    database_id = config.get(\"database_id\")\n    if not catalog or database_id is None:\n        return\n\n    database = db.session.query(Database).filter_by(id=database_id).first()\n    if database is None or not database.db_engine_spec.supports_catalog:\n        return\n\n    # Only validate when the connection has a known default catalog to compare\n    # against; without one there is no \"non-default\" catalog to reject.\n    default_catalog = database.get_default_catalog()\n    if (\n        default_catalog is not None\n        and not database.allow_multi_catalog\n        and catalog != default_catalog\n    ):\n        raise MultiCatalogDisabledValidationError()\n\n\ndef import_dataset(  # noqa: C901\n    config: dict[str, Any],\n    overwrite: bool = False,\n    force_data: bool = False,\n    ignore_permissions: bool = False,\n) -> SqlaTable:\n    \"\"\"Import a dataset from a config dict, handling existing matches.\n\n    Permission model for an existing UUID match:\n\n    +--------------+---------------+---------------------+-----------------+\n    | Existing row | overwrite arg | Caller has perms?   | Outcome         |\n    +==============+===============+=====================+=================+\n    | alive        | False         | (n/a)               | return existing |\n    +--------------+---------------+---------------------+-----------------+\n    | alive        | True          | can_write + editor  | UPDATE in place |","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/importers/v1/utils.py#L180-L216","documentation":"validate_catalog rejects an imported dataset config whose 'catalog' differs from the target database's default catalog when the database's engine does not allow multiple catalogs (allow_multi_catalog false) and a known default catalog exists. It mirrors the REST update-path validation so an import cannot silently bind a dataset to a catalog the connection does not expose, which would route queries to the wrong place.","triggerScenarios":"Untrusted dataset import (ignore_permissions False) where config['catalog'] is set, config['database_id'] resolves, the engine spec supports catalogs, a default catalog is derivable, allow_multi_catalog is false, and catalog != default_catalog.","commonSituations":"Promoting a dataset exported from a multi-catalog Trino/Spark/Presto cluster to a single-catalog connection; connection strings that pin catalog=x while the YAML says catalog=y.","solutions":["Set the YAML 'catalog' to the connection's default catalog, or delete the field","Re-point the dataset at a database connection whose default catalog matches the YAML catalog","Enable multi-catalog for the connection if the engine supports it"],"exampleFix":"# before (YAML)\ncatalog: sales_prod\n# after — match the URI's pinned catalog\ncatalog: default","handlingStrategy":"validation","validationCode":"from superset.commands.dataset.importers.v1.utils import validate_catalog\n\nfor cfg in dataset_configs:\n    validate_catalog({'catalog': cfg.get('catalog'), 'database_id': cfg['database_id']})\n# raises MultiCatalogDisabledValidationError before any rows are written","typeGuard":null,"tryCatchPattern":"from superset.commands.dataset.exceptions import MultiCatalogDisabledValidationError\ntry:\n    import_dataset(config)\nexcept MultiCatalogDisabledValidationError:\n    cfg['catalog'] = default_catalog  # normalize and retry once\n    import_dataset(cfg)","preventionTips":["Strip or normalize the catalog field when exporting for single-catalog targets","Know each connection's default catalog before importing","Enable multi-catalog deliberately, not accidentally"],"tags":["dataset-import","catalog","validation","superset"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}