Skip to content

Commit

Permalink
fix: export_tabular_by_visualization_id does not need to call afm-exe…
Browse files Browse the repository at this point in the history
…c-api

It is not necessary to execute visualization and get `execution_result` for `export_tabular_by_visualization_id`. Now export by visualization_id is supported out of the box.

JIRA: TRIVIAL
risk: low
  • Loading branch information
hkad98 committed Oct 21, 2024
1 parent 18913cc commit b093dad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions gooddata-sdk/gooddata_sdk/catalog/export/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ExportRequest(Base):
format: str
file_name: str
execution_result: Optional[str] = None
visualization_object: Optional[str] = None
settings: Optional[ExportSettings] = None
custom_override: Optional[ExportCustomOverride] = None

Expand Down
9 changes: 3 additions & 6 deletions gooddata-sdk/gooddata_sdk/catalog/export/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def export_tabular_by_visualization_id(
workspace_id (str): The workspace id from which the visualization is to be exported.
visualization_id (str): The id of the visualization to be exported.
file_format (str): The format of the file to be exported.
file_name (Optional[str], optional): The name which the exported file should have. Defaults to None.
file_name (Optional[str], optional): The name which the exported file should have. Defaults to "export".
settings (Optional[ExportSettings], optional): Any additional settings for the export. Defaults to None.
store_path (Union[str, Path], optional): The path to store the exported file. Default to Path.cwd().
timeout (float, optional): The maximum time to wait for the export to finish. Defaults to 60.0.
Expand All @@ -321,15 +321,12 @@ def export_tabular_by_visualization_id(
Returns:
None
"""
exec_table, visualization_tile = self._get_visualization_exec_table(workspace_id, visualization_id)
custom_override = self._custom_overrides_labels(exec_table)
file_name = file_name if file_name is not None else visualization_tile
file_name = file_name if file_name is not None else "export"
export_request = ExportRequest(
format=file_format,
execution_result=exec_table.result_id,
visualization_object=visualization_id,
file_name=file_name,
settings=settings,
custom_override=custom_override,
)
self.export_tabular(
workspace_id=workspace_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from attrs import define, field
from gooddata_api_client.model.declarative_notification_channel import DeclarativeNotificationChannel
from gooddata_api_client.model.webhook import Webhook

from gooddata_sdk.catalog.base import Base

# TODO: there is an issue with generated client which causes these two classes to fail
Expand Down

0 comments on commit b093dad

Please sign in to comment.