export.
export_tabular
export_tabular(workspace_id: str, export_request: ExportRequest, file_name: str, store_path: Union[str, Path] = Path.cwd(), timeout: float = 60.0, retry: float = 0.2, max_retry: float = 5.0, )
Export Tabular (CSV, XLSX) data from the specified GoodData Dashboard report, saved to the specified file path.
Parameters
name | type | description |
---|---|---|
workspace_id | string | The ID of the GoodData Workspace. |
export_request | ExportRequest | An instance of ExportRequest containing the required information for the tabular export. |
store_path | Union[String, Path] | The path to save the exported tabular data. Defaults to Path.cwd(). |
timeout | float | The maximum amount of time (in seconds) to wait for the server to process the export. Defaults to 60.0. |
retry | float | Initial wait time (in seconds) before retrying to get the exported content. Defaults to 0.2. |
max_retry | float | The maximum retry wait time (in seconds). Defaults to 5.0. |
Returns
None
Example
host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)
workspace_id = "demo"
exec_def = ExecutionDefinition(
attributes=[Attribute(local_id="region", label="region"), Attribute(local_id="state", label="state")],
metrics=[
SimpleMetric(local_id="price", item=ObjId(id="price", type="fact")),
SimpleMetric(local_id="order_amount", item=ObjId(id="order_amount", type="metric")),
],
filters=[],
dimensions=[
TableDimension(item_ids=["state", "region"]),
TableDimension(item_ids=["measureGroup"]),
],
)
execution_result=sdk.compute.for_exec_def(workspace_id, exec_def).result_id
export_request = ExportRequest(
format="CSV",
execution_result=execution_result,
file_name="my_file",
custom_override=ExportCustomOverride(
labels={"region": ExportCustomLabel(title="Custom Title Region")},
metrics={
"price": ExportCustomMetric(title="Sum Of Price", format=""),
"order_amount": ExportCustomMetric(title="Order Amount Metric", format="#,##0.00"),
},
),
)
sdk.export.export_tabular(workspace_id, export_request, _exports_dir)