Skip to content

Commit

Permalink
chore(export): Added ability to export chart YAML files with Unicode …
Browse files Browse the repository at this point in the history
…characters, fix apache#20331
  • Loading branch information
xyb committed May 22, 2024
1 parent 4fa7619 commit f87f1f9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion superset/commands/chart/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _file_content(model: Slice) -> str:
if model.table:
payload["dataset_uuid"] = str(model.table.uuid)

file_content = yaml.safe_dump(payload, sort_keys=False)
file_content = yaml.safe_dump(payload, sort_keys=False, allow_unicode=True)
return file_content

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion superset/commands/dashboard/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _file_content(model: Dashboard) -> str:

payload["version"] = EXPORT_VERSION

file_content = yaml.safe_dump(payload, sort_keys=False)
file_content = yaml.safe_dump(payload, sort_keys=False, allow_unicode=True)
return file_content

@staticmethod
Expand Down
7 changes: 5 additions & 2 deletions superset/commands/database/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _file_content(model: Database) -> str:

payload["version"] = EXPORT_VERSION

file_content = yaml.safe_dump(payload, sort_keys=False)
file_content = yaml.safe_dump(payload, sort_keys=False, allow_unicode=True)
return file_content

@staticmethod
Expand Down Expand Up @@ -131,6 +131,9 @@ def _export(
yield (
file_path,
functools.partial( # type: ignore
yaml.safe_dump, payload, sort_keys=False
yaml.safe_dump,
payload,
sort_keys=False,
allow_unicode=True,
),
)
7 changes: 5 additions & 2 deletions superset/commands/dataset/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _file_content(model: SqlaTable) -> str:
payload["version"] = EXPORT_VERSION
payload["database_uuid"] = str(model.database.uuid)

file_content = yaml.safe_dump(payload, sort_keys=False)
file_content = yaml.safe_dump(payload, sort_keys=False, allow_unicode=True)
return file_content

@staticmethod
Expand Down Expand Up @@ -122,4 +122,7 @@ def _export(

payload["version"] = EXPORT_VERSION

yield file_path, lambda: yaml.safe_dump(payload, sort_keys=False)
yield (
file_path,
lambda: yaml.safe_dump(payload, sort_keys=False, allow_unicode=True),
)

0 comments on commit f87f1f9

Please sign in to comment.