{"record":{"id":"9cb0b494ac72ea27","repo":"apache/superset","slug":"you-don-t-have-access-to-this-dataset-9cb0b4","errorCode":null,"errorMessage":"You don't have access to this dataset.","messagePattern":"You don't have access to this dataset\\.","errorType":"exception","errorClass":"DatasetAccessDeniedError","httpStatus":403,"severity":"error","filePath":"superset/commands/dataset/importers/v1/utils.py","lineNumber":511,"sourceCode":"        # visibility filter so a soft-deleted duplicate can be located\n        # too — without the bypass the listener would hide the row and\n        # the ``.one()`` would raise NoResultFound, masking the\n        # original MultipleResultsFound.\n        dataset = (\n            db.session.query(SqlaTable)\n            .execution_options(**{SKIP_VISIBILITY_FILTER_CLASSES: {SqlaTable}})\n            .filter_by(uuid=config[\"uuid\"])\n            .one()\n        )\n\n    if dataset.id is None:\n        db.session.flush()\n\n    if not ignore_permissions:\n        try:\n            security_manager.raise_for_access(datasource=dataset)\n        except SupersetSecurityException as ex:\n            raise DatasetAccessDeniedError() from ex\n\n    try:\n        table_exists = dataset.database.has_table(\n            Table(dataset.table_name, dataset.schema, dataset.catalog),\n        )\n    except Exception:  # pylint: disable=broad-except\n        # MySQL doesn't play nice with GSheets table names\n        logger.warning(\n            \"Couldn't check if table %s exists, assuming it does\", dataset.table_name\n        )\n        table_exists = True\n\n    if data_uri and (not table_exists or force_data):\n        load_data(data_uri, dataset, dataset.database)\n\n    if user:\n        from superset.subjects.utils import get_user_subject\n","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/importers/v1/utils.py#L493-L529","documentation":"After a dataset is imported (or matched), import_dataset calls security_manager.raise_for_access(datasource=dataset) unless ignore_permissions is set. If the importing user lacks access to the dataset's database/schema/table per the RBAC/RLS rules, SupersetSecurityException is converted to DatasetAccessDeniedError ('You don't have access to this dataset.').","triggerScenarios":"A user imports a bundle referencing a database or schema they have no 'database access'/'schema access' grant for (or RLS rules deny it); common when analysts import bundles built on data sources outside their grants.","commonSituations":"Importing example or shared bundles that point at restricted databases; role missing can_access on the target database; RLS rules rejecting the user on the dataset's table.","solutions":["Grant the importing user's role access to the target database (and schema/dataset) via Settings → Database / Roles, then retry","Import a bundle whose datasets reference databases the user can access","Run the import as a user with the appropriate data-access grants"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from superset import security_manager\n# pre-flight: confirm the current user can access every database referenced by the bundle\nfor cfg in dataset_configs:\n    db = session.query(Database).filter_by(id=cfg['database_id']).first()\n    security_manager.raise_for_access(database=db)  # raises before any import work","typeGuard":null,"tryCatchPattern":"from superset.commands.dataset.exceptions import DatasetAccessDeniedError\ntry:\n    import_dataset(config)\nexcept DatasetAccessDeniedError:\n    # grant database/schema access to the user's role, or import a bundle they can access\n    ...","preventionTips":["Scope import bundles to databases the importing role can access","Grant database access before distributing bundles built on new sources","Remember RLS rules also apply on import — test with the importing user's role"],"tags":["dataset-import","permissions","rbac","access-denied","superset"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}