apache/superset · error · DatabaseSchemaUploadNotAllowed

Database schema is not allowed for csv uploads.

Error message

Database schema is not allowed for csv uploads.

What it means

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.

Source

Thrown at superset/commands/database/uploaders/base.py:291

            # degrade to the no-schema behavior rather than fail the upload.
            logger.warning(
                "Unable to resolve default schema for upload; proceeding without one",
                exc_info=True,
            )
            return None

    def validate(self) -> None:
        self._model = DatabaseDAO.find_by_id(self._model_id)
        if not self._model:
            raise DatabaseNotFoundError()
        engine_resolved = False
        if not self._schema:
            self._schema = self._resolve_default_schema(self._model)
            engine_resolved = self._schema is not None
        if not schema_allows_file_upload(
            self._model, self._schema, engine_resolved=engine_resolved
        ):
            raise DatabaseSchemaUploadNotAllowed()
        if not self._model.db_engine_spec.supports_file_upload:
            raise DatabaseUploadNotSupported()

        self.validate_file_size(self._file)

View on GitHub (pinned to f4587218dd)

Solutions

  1. Add the target schema to schemas_allowed_for_file_upload in superset_config.py
  2. Or upload into an allowed schema
  3. If the default-schema resolution is the issue, allowlist the database's default schema

Example fix

# superset_config.py
 # before
 # schemas_allowed_for_file_upload not set

 # after
 schemas_allowed_for_file_upload = {"public", "uploads"}
Defensive patterns

Strategy: validation

Validate before calling

from superset.databases.schemas import is_schema_allowed

allowed = current_app.config["SCHEMAS_ALLOWED_FOR_FILE_UPLOAD"]
if allowed and schema not in allowed:
    raise ValueError(f"schema {schema!r} not allowed for uploads")

Try / catch

try:
    UploadCommand(...).run()
except DatabaseSchemaUploadNotAllowed:
    # prompt for allowed schema or update config allowlist
    ...

Prevention

When it happens

Trigger: 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.

Common situations: Enabling CSV upload without configuring the allowlist; default schema resolution (see #36305 handling) turning a previously-allowed NULL-schema upload into a blocked one.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/21144283867e17e6. Report an issue: GitHub.