Skip to content

Commit 4639b91

Browse files
authored
Merge pull request #754 from hkad98/export-pdf
feat: add metadata to export_pdf
2 parents 2b35d0d + 48d333a commit 4639b91

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

docs/content/en/latest/execution/exports/export_pdf.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ superheading: "export."
1212
timeout: float = 60.0,
1313
retry: float = 0.2,
1414
max_retry: float = 5.0,
15+
metadata: Optional[Dict[str, Any]] = None,
1516
)``
1617

1718
Export a PDF of the specified GoodData Dashboard and save it to the specified file path.
@@ -39,6 +40,9 @@ Initial wait time (in seconds) before retrying to get the exported content. Defa
3940
{{< parameter p_name="max_retry" p_type="float" >}}
4041
The maximum retry wait time (in seconds). Defaults to 5.0.
4142
{{< /parameter >}}
43+
{{< parameter p_name="metadata" p_type="Optional[Dict[str, Any]]" >}}
44+
Specify the metadata for the export. Specific metadata can override filtering.
45+
{{< /parameter >}}
4246
{{% /parameters-block %}}
4347

4448
{{% parameters-block title="Returns" None="true"%}}

gooddata-flight-server/gooddata_flight_server/flexfun/flex_fun_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# (C) 2024 GoodData Corporation
22
import importlib
3-
from typing import Dict, Iterable, List, Type
3+
from typing import Dict, Iterable, List, Tuple, Type
44

55
import structlog
66

@@ -21,7 +21,7 @@ def __init__(self) -> None:
2121
self._loaded_modules: List[str] = []
2222

2323
@property
24-
def flex_funs_names(self) -> tuple[str, ...]:
24+
def flex_funs_names(self) -> Tuple[str, ...]:
2525
"""
2626
:return: names of available functions
2727
"""

gooddata-sdk/gooddata_sdk/catalog/export/service.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# (C) 2023 GoodData Corporation
22
import time
33
from pathlib import Path
4-
from typing import Callable, Optional, Tuple, Union
4+
from typing import Any, Callable, Dict, Optional, Tuple, Union
55

66
from gooddata_api_client.exceptions import NotFoundException
77
from gooddata_api_client.model.tabular_export_request import TabularExportRequest
@@ -189,6 +189,7 @@ def export_pdf(
189189
timeout: float = 60.0,
190190
retry: float = 0.2,
191191
max_retry: float = 5.0,
192+
metadata: Optional[Dict[str, Any]] = None,
192193
) -> None:
193194
"""
194195
Export a PDF of the specified GoodData Dashboard and save it to the specified file path.
@@ -200,18 +201,25 @@ def export_pdf(
200201
file_name (str):
201202
The name of the PDF file (excluding the file extension).
202203
store_path (Union[str, Path], optional):
203-
The path to save the exported PDF. Defaults to the current directory.
204+
The path to save the exported PDF.
205+
Defaults to the current directory.
204206
timeout (float, optional):
205-
The maximum amount of time (in seconds) to wait for the server to process the export. Defaults to 60.0.
207+
The maximum amount of time (in seconds) to wait for the server to process the export.
208+
Defaults to 60.0.
206209
retry (float, optional):
207-
Initial wait time (in seconds) before retrying to get the exported content. Defaults to 0.2.
210+
Initial wait time (in seconds) before retrying to get the exported content.
211+
Defaults to 0.2.
208212
max_retry (float, optional):
209-
The maximum retry wait time (in seconds). Defaults to 5.0.
213+
The maximum retry wait time (in seconds).
214+
Defaults to 5.0.
215+
metadata (Dict[str, Any]):
216+
Specify the metadata for the export.
217+
Specific metadata can override filtering.
210218
"""
211219
if not self._dashboard_id_exists(workspace_id, dashboard_id):
212220
raise ValueError(f"Dashboard id '{dashboard_id}' does not exist for workspace '{workspace_id}'.")
213221
store_path = store_path if isinstance(store_path, Path) else Path(store_path)
214-
request = VisualExportRequest(dashboard_id=dashboard_id, file_name=file_name)
222+
request = VisualExportRequest(dashboard_id=dashboard_id, file_name=file_name, metadata=metadata)
215223
file_path = store_path / f"{file_name}.pdf"
216224
create_func = self._actions_api.create_pdf_export
217225
get_func = self._actions_api.get_exported_file

0 commit comments

Comments
 (0)