mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat(examples): Modernize example data loading with Parquet and YAML configs (#36538)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,7 @@ from superset.utils import json
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def import_database(
|
||||
def import_database( # noqa: C901
|
||||
config: dict[str, Any],
|
||||
overwrite: bool = False,
|
||||
ignore_permissions: bool = False,
|
||||
@@ -59,8 +59,14 @@ def import_database(
|
||||
except SupersetSecurityException as exc:
|
||||
raise ImportFailedError(exc.message) from exc
|
||||
# https://github.com/apache/superset/pull/16756 renamed ``csv`` to ``file``.
|
||||
config["allow_file_upload"] = config.pop("allow_csv_upload")
|
||||
if "schemas_allowed_for_csv_upload" in config["extra"]:
|
||||
# Handle both old and new field names, defaulting to True for examples database
|
||||
if "allow_csv_upload" in config:
|
||||
config["allow_file_upload"] = config.pop("allow_csv_upload")
|
||||
elif "allow_file_upload" not in config:
|
||||
# Default to True for backward compatibility
|
||||
config["allow_file_upload"] = True
|
||||
|
||||
if "schemas_allowed_for_csv_upload" in config.get("extra", {}):
|
||||
config["extra"]["schemas_allowed_for_file_upload"] = config["extra"].pop(
|
||||
"schemas_allowed_for_csv_upload"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user