{"record":{"id":"21144283867e17e6","repo":"apache/superset","slug":"database-schema-is-not-allowed-for-csv-uploads","errorCode":null,"errorMessage":"Database schema is not allowed for csv uploads.","messagePattern":"Database schema is not allowed for csv uploads\\.","errorType":"exception","errorClass":"DatabaseSchemaUploadNotAllowed","httpStatus":403,"severity":"error","filePath":"superset/commands/database/uploaders/base.py","lineNumber":291,"sourceCode":"            # degrade to the no-schema behavior rather than fail the upload.\n            logger.warning(\n                \"Unable to resolve default schema for upload; proceeding without one\",\n                exc_info=True,\n            )\n            return None\n\n    def validate(self) -> None:\n        self._model = DatabaseDAO.find_by_id(self._model_id)\n        if not self._model:\n            raise DatabaseNotFoundError()\n        engine_resolved = False\n        if not self._schema:\n            self._schema = self._resolve_default_schema(self._model)\n            engine_resolved = self._schema is not None\n        if not schema_allows_file_upload(\n            self._model, self._schema, engine_resolved=engine_resolved\n        ):\n            raise DatabaseSchemaUploadNotAllowed()\n        if not self._model.db_engine_spec.supports_file_upload:\n            raise DatabaseUploadNotSupported()\n\n        self.validate_file_size(self._file)\n","sourceCodeStart":273,"sourceCodeEnd":296,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/database/uploaders/base.py#L273-L296","documentation":"DatabaseSchemaUploadNotAllowed is raised when schema_allows_file_upload(self._model, self._schema, engine_resolved=...) is False. Uploads are only permitted into schemas listed in the ALLOWED_USER_CSV_UPLOAD_SCHEMAS / schemas_allowed_for_file_upload config; note an explicitly resolved default schema counts against the allowlist even if the user left schema blank.","triggerScenarios":"UPLOAD feature used on a database whose schemas_allowed_for_file_upload is unset or does not include the target schema; the resolved default schema is not on the list.","commonSituations":"Enabling CSV upload without configuring the allowlist; default schema resolution (see #36305 handling) turning a previously-allowed NULL-schema upload into a blocked one.","solutions":["Add the target schema to schemas_allowed_for_file_upload in superset_config.py","Or upload into an allowed schema","If the default-schema resolution is the issue, allowlist the database's default schema"],"exampleFix":"# superset_config.py\n # before\n # schemas_allowed_for_file_upload not set\n\n # after\n schemas_allowed_for_file_upload = {\"public\", \"uploads\"}","handlingStrategy":"validation","validationCode":"from superset.databases.schemas import is_schema_allowed\n\nallowed = current_app.config[\"SCHEMAS_ALLOWED_FOR_FILE_UPLOAD\"]\nif allowed and schema not in allowed:\n    raise ValueError(f\"schema {schema!r} not allowed for uploads\")","typeGuard":null,"tryCatchPattern":"try:\n    UploadCommand(...).run()\nexcept DatabaseSchemaUploadNotAllowed:\n    # prompt for allowed schema or update config allowlist\n    ...","preventionTips":["Configure schemas_allowed_for_file_upload when enabling uploads","Allowlist the default schema too, since default-schema resolution now fills blank schemas"],"tags":["upload","schema","config","authorization"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}