{"record":{"id":"aafea708a60df1e1","repo":"apache/superset","slug":"database-upload-file-exceeds-the-maximum-allowed-s","errorCode":null,"errorMessage":"Database upload file exceeds the maximum allowed size.","messagePattern":"Database upload file exceeds the maximum allowed size\\.","errorType":"exception","errorClass":"DatabaseUploadFileTooLarge","httpStatus":413,"severity":"error","filePath":"superset/commands/database/uploaders/base.py","lineNumber":262,"sourceCode":"        return size\n\n    @classmethod\n    def validate_file_size(cls, file: Any) -> None:\n        \"\"\"\n        Reject a file whose size exceeds ``UPLOAD_MAX_FILE_SIZE_BYTES``.\n\n        Shared by the upload command and the metadata endpoint so oversized\n        files are rejected before their contents are read into memory,\n        regardless of which path is used.\n\n        :raises DatabaseUploadFileTooLarge: if the file is larger than the limit\n        \"\"\"\n        max_file_size = current_app.config.get(\"UPLOAD_MAX_FILE_SIZE_BYTES\")\n        if max_file_size is None or file is None:\n            return\n        size = cls._file_size_bytes(file)\n        if size is not None and size > max_file_size:\n            raise DatabaseUploadFileTooLarge()\n\n    @staticmethod\n    def _resolve_default_schema(database: Database) -> Optional[str]:\n        \"\"\"Resolve the database's default schema so uploaded datasets carry an\n        explicit schema instead of NULL, which would otherwise duplicate an\n        existing dataset over the same table (see #36305).\"\"\"\n        try:\n            return database.get_default_schema(database.get_default_catalog())\n        except Exception:  # pylint: disable=broad-except\n            # Resolution opens an inspector connection; a failure here must\n            # 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:","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/database/uploaders/base.py#L244-L280","documentation":"DatabaseUploadFileTooLarge is raised by validate_file_size when the uploaded file exceeds UPLOAD_MAX_FILE_SIZE_BYTES. The check is shared by the upload command and the metadata endpoint so oversized files are rejected before being read into memory.","triggerScenarios":"Uploading a CSV/Excel larger than UPLOAD_MAX_FILE_SIZE_BYTES (default caps apply when configured); checking file metadata on an oversized file.","commonSituations":"Large exports uploaded without chunking; operators lowering the limit; environments with strict memory budgets.","solutions":["Split the file or upload a smaller extract","Raise UPLOAD_MAX_FILE_SIZE_BYTES in superset_config.py if the deployment can afford the memory","Stream/load the data directly into the database instead of the UI upload path"],"exampleFix":"# superset_config.py\n # before\n # (no override; default limit hit)\n\n # after\n UPLOAD_MAX_FILE_SIZE_BYTES = 500 * 1024 * 1024  # 500MB, if resources allow","handlingStrategy":"validation","validationCode":"max_size = current_app.config.get(\"UPLOAD_MAX_FILE_SIZE_BYTES\")\nif max_size is not None:\n    file.seek(0, 2)\n    size = file.tell()\n    file.seek(0)\n    if size > max_size:\n        raise ValueError(f\"file {size}B exceeds limit {max_size}B\")","typeGuard":null,"tryCatchPattern":"try:\n    UploadCommand(...).run()\nexcept DatabaseUploadFileTooLarge:\n    # prompt for a smaller/split file\n    ...","preventionTips":["Check file size client-side before starting the upload","Chunk large datasets into the DB directly"],"tags":["upload","file-size","limits"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}