Skip to content

Commit 9d40327

Browse files
authored
Merge pull request #686 from hkad98/remove-deprecated
feat: remove deprecated occurrence of `insight`
2 parents c0626b8 + 714b376 commit 9d40327

File tree

12 files changed

+15
-196
lines changed

12 files changed

+15
-196
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ But there is one disadvantage. One needs GD.CN instance with the original setup
178178
`docker-compose.yaml` in root of the repository is here to help. It starts:
179179
- GD.CN AIO in selected version
180180
- postgres with gooddata-fdw extension
181-
- service which setups GD.CN AIO demo project including PDM, LDM, metrics and insights
181+
- service which setups GD.CN AIO demo project including PDM, LDM, metrics and visualizations
182182
183183
When a vcrpy supported test needs to be updated:
184184
- start GD.CN using above `docker-compose.yaml`

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Check out the GoodData Pandas [documentation](https://gooddata-pandas.readthedoc
3333
> GoodData Foreign Data Wrapper is currently deprecated.
3434
3535
The [gooddata-fdw](./gooddata-fdw) package provides a way
36-
to map GoodData Cloud semantic layer and/or insights stored in your GoodData Cloud
36+
to map GoodData Cloud semantic layer and/or visualizations stored in your GoodData Cloud
3737
into PostgreSQL as foreign tables that you can then query using SQL.
3838

3939
Check out the GoodData Foreign Data Wrapper [documentation](https://gooddata-fdw.readthedocs.io/en/latest/) to learn more and get started.

gooddata-dbt/gooddata_dbt/gooddata/api_wrapper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, sdk: GoodDataSdk, logger: logging.Logger, dry_run: bool = Fal
3737

3838
def get_visualizations(self, workspace_id: str) -> List[Visualization]:
3939
if self.dry_run:
40-
self.logger.info("Dry run - skipping insights listing")
40+
self.logger.info("Dry run - skipping visualizations listing")
4141
return []
4242
else:
4343
return self.sdk.visualizations.get_visualizations(workspace_id)

gooddata-pandas/docs/examples.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ Data Frames
7171
)
7272
)
7373
74-
# create data frame based on the contents of the insight. if the insight contains labels and
74+
# create data frame based on the contents of the visualization. if the visualization contains labels and
7575
# measures, the data frame will contain index or hierarchical index.
76-
insight_df = frames.for_insight('insight_id')
76+
visualization_df = frames.for_visualization('visualization_id')
7777
7878
# create data frame based on the content of the items dict. if the dict contains both labels
7979
# and measures, the frame will contain index or hierarchical index.

gooddata-pandas/gooddata_pandas/dataframe.py

-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import annotations
33

44
from typing import Optional, Tuple, Union
5-
from warnings import warn
65

76
import pandas
87
from gooddata_api_client import models
@@ -184,15 +183,6 @@ def for_visualization(self, visualization_id: str, auto_index: bool = True) -> p
184183

185184
return self.for_items(columns, filter_by=filter_by, auto_index=auto_index)
186185

187-
def for_insight(self, insight_id: str, auto_index: bool = True) -> pandas.DataFrame:
188-
warn(
189-
"This method is deprecated and it will be removed in v1.20.0 release. "
190-
"Please use 'for_visualization' method instead.",
191-
DeprecationWarning,
192-
stacklevel=2,
193-
)
194-
return self.for_visualization(insight_id, auto_index)
195-
196186
def result_cache_metadata_for_exec_result_id(self, result_id: str) -> ResultCacheMetadata:
197187
"""
198188
Retrieves result cache metadata for given :result_id:

gooddata-sdk/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ At the moment the SDK provides services to inspect and interact with the Semanti
99
* Catalog User Service
1010
* Catalog Permission Service
1111
* Catalog Organization Service
12-
* Insights Service
12+
* Visualizations Service
1313
* Compute Service
1414
* Table Service
1515

@@ -28,7 +28,7 @@ Run the following command to install the `gooddata-sdk` package on your system:
2828

2929
## Example
3030

31-
Compute an insight:
31+
Compute an visualization:
3232
```python
3333
import gooddata_sdk
3434

@@ -39,11 +39,11 @@ token = "some_user_token"
3939
sdk = gooddata_sdk.GoodDataSdk.create(host, token)
4040

4141
workspace_id = "demo"
42-
insight_id = "customers_trend"
43-
# reads insight from workspace
44-
insight = sdk.visualizations.get_visualization(workspace_id, insight_id)
45-
# triggers computation for the insight. the result will be returned in a tabular form
46-
table = sdk.tables.for_visualization(workspace_id, insight)
42+
visualization_id = "customers_trend"
43+
# reads visualization from workspace
44+
visualization = sdk.visualizations.get_visualization(workspace_id, visualization_id)
45+
# triggers computation for the visualization. the result will be returned in a tabular form
46+
table = sdk.tables.for_visualization(workspace_id, visualization)
4747

4848
# and this is how you can read data row-by-row and do something with it
4949
for row in table.read_all():

gooddata-sdk/gooddata_sdk/__init__.py

-5
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,6 @@
230230
from gooddata_sdk.table import ExecutionTable, TableService
231231
from gooddata_sdk.utils import SideLoads
232232
from gooddata_sdk.visualization import (
233-
Insight,
234-
InsightAttribute,
235-
InsightBucket,
236-
InsightMetric,
237-
InsightService,
238233
Visualization,
239234
VisualizationAttribute,
240235
VisualizationBucket,

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

-40
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33
from pathlib import Path
44
from typing import Callable, Optional, Tuple, Union
5-
from warnings import warn
65

76
from gooddata_api_client.exceptions import NotFoundException
87
from gooddata_api_client.model.pdf_export_request import PdfExportRequest
@@ -284,15 +283,6 @@ def _get_visualization_exec_table(self, workspace_id: str, visualization_id: str
284283
f"or visualization visualization_id='{visualization_id}' does not exist."
285284
)
286285

287-
def _get_insight_exec_table(self, workspace_id: str, insight_id: str) -> Tuple[ExecutionTable, str]:
288-
warn(
289-
"This method is deprecated and it will be removed in v1.20.0 release. "
290-
"Please use '_get_visualization_exec_table' method instead.",
291-
DeprecationWarning,
292-
stacklevel=2,
293-
)
294-
return self._get_visualization_exec_table(workspace_id, insight_id)
295-
296286
def export_tabular_by_visualization_id(
297287
self,
298288
workspace_id: str,
@@ -341,33 +331,3 @@ def export_tabular_by_visualization_id(
341331
retry=retry,
342332
max_retry=max_retry,
343333
)
344-
345-
def export_tabular_by_insight_id(
346-
self,
347-
workspace_id: str,
348-
insight_id: str,
349-
file_format: str,
350-
file_name: Optional[str] = None,
351-
settings: Optional[ExportSettings] = None,
352-
store_path: Union[str, Path] = Path.cwd(),
353-
timeout: float = 60.0,
354-
retry: float = 0.2,
355-
max_retry: float = 5.0,
356-
) -> None:
357-
warn(
358-
"This method is deprecated and it will be removed in v1.20.0 release. "
359-
"Please use 'export_tabular_by_visualization_id' method instead.",
360-
DeprecationWarning,
361-
stacklevel=2,
362-
)
363-
self.export_tabular_by_visualization_id(
364-
workspace_id,
365-
insight_id,
366-
file_format,
367-
file_name,
368-
settings,
369-
store_path,
370-
timeout,
371-
retry,
372-
max_retry,
373-
)

gooddata-sdk/gooddata_sdk/sdk.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from pathlib import Path
55
from typing import Optional
6-
from warnings import warn
76

87
from gooddata_sdk.catalog.data_source.service import CatalogDataSourceService
98
from gooddata_sdk.catalog.export.service import ExportService
@@ -17,7 +16,7 @@
1716
from gooddata_sdk.support import SupportService
1817
from gooddata_sdk.table import TableService
1918
from gooddata_sdk.utils import PROFILES_FILE_PATH, profile_content
20-
from gooddata_sdk.visualization import InsightService, VisualizationService
19+
from gooddata_sdk.visualization import VisualizationService
2120

2221

2322
class GoodDataSdk:
@@ -74,7 +73,6 @@ def __init__(self, client: GoodDataApiClient) -> None:
7473
self._catalog_organization = CatalogOrganizationService(self._client)
7574
self._catalog_user = CatalogUserService(self._client)
7675
self._compute = ComputeService(self._client)
77-
self._insights = InsightService(self._client)
7876
self._visualizations = VisualizationService(self._client)
7977
self._tables = TableService(self._client)
8078
self._support = SupportService(self._client)
@@ -101,16 +99,6 @@ def catalog_organization(self) -> CatalogOrganizationService:
10199
def compute(self) -> ComputeService:
102100
return self._compute
103101

104-
@property
105-
def insights(self) -> InsightService:
106-
warn(
107-
"This property is deprecated and it will be removed in v1.20.0 release. "
108-
"Please use 'visualizations' property instead.",
109-
DeprecationWarning,
110-
stacklevel=2,
111-
)
112-
return self._insights
113-
114102
@property
115103
def visualizations(self) -> VisualizationService:
116104
return self._visualizations

gooddata-sdk/gooddata_sdk/table.py

-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import logging
55
from operator import attrgetter
66
from typing import Any, Callable, Dict, Generator, List, Optional, Union
7-
from warnings import warn
87

98
from attrs import define, field, frozen
109
from attrs.setters import frozen as frozen_attr
@@ -25,7 +24,6 @@
2524
from gooddata_sdk.visualization import (
2625
AttributeSortType,
2726
BucketType,
28-
Insight,
2927
LocatorItemType,
3028
SortDirection,
3129
SortType,
@@ -785,15 +783,6 @@ def for_visualization(self, workspace_id: str, visualization: Visualization) ->
785783
response = self._compute.for_exec_def(workspace_id=workspace_id, exec_def=exec_def)
786784
return _as_table(response)
787785

788-
def for_insight(self, workspace_id: str, insight: Insight) -> ExecutionTable:
789-
warn(
790-
"This method is deprecated and it will be removed in v1.20.0 release. "
791-
"Please use 'for_visualization' method instead.",
792-
DeprecationWarning,
793-
stacklevel=2,
794-
)
795-
return self.for_visualization(workspace_id=workspace_id, visualization=insight)
796-
797786
def for_items(
798787
self, workspace_id: str, items: list[Union[Attribute, Metric]], filters: Optional[list[Filter]] = None
799788
) -> ExecutionTable:

gooddata-sdk/gooddata_sdk/visualization.py

+1-104
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from collections import defaultdict
66
from enum import Enum
77
from typing import Any, Optional, Union, cast
8-
from warnings import warn
98

109
from gooddata_sdk.client import GoodDataApiClient
1110
from gooddata_sdk.compute.model.attribute import Attribute
@@ -661,7 +660,7 @@ def get_metadata(self, id_obj: IdObjType) -> Optional[Any]:
661660

662661
def get_labels_and_formats(self) -> tuple[dict[str, str], dict[str, str]]:
663662
"""
664-
Extracts labels and custom measure formats from the insight.
663+
Extracts labels and custom measure formats from the visualization.
665664
666665
:return: tuple of labels dict ({"label_id":"Label"}) and formats dict ({"measure_id":"#,##0.00"})
667666
"""
@@ -759,105 +758,3 @@ def get_visualization(self, workspace_id: str, visualization_id: str) -> Visuali
759758
side_loads = SideLoads(vis_obj.included)
760759

761760
return Visualization(vis_obj.data, side_loads)
762-
763-
def get_insights(self, workspace_id: str) -> list[Visualization]:
764-
warn(
765-
"This method is deprecated and it will be removed in v1.20.0 release. "
766-
"Please use 'get_visualizations' method instead.",
767-
DeprecationWarning,
768-
stacklevel=2,
769-
)
770-
return self.get_visualizations(workspace_id)
771-
772-
def get_insight(self, workspace_id: str, insight_id: str) -> Visualization:
773-
warn(
774-
"This method is deprecated and it will be removed in v1.20.0 release. "
775-
"Please use 'get_visualization' method instead.",
776-
DeprecationWarning,
777-
stacklevel=2,
778-
)
779-
return self.get_visualization(workspace_id, insight_id)
780-
781-
782-
# Note: the classes below are going to be deprecated
783-
784-
785-
class InsightMetric(VisualizationMetric):
786-
def __init__(self, metric: dict[str, Any]) -> None:
787-
warn(
788-
"This class is deprecated and it will be removed in v1.20.0 release. "
789-
"Please use 'VisualizationMetric' class instead.",
790-
DeprecationWarning,
791-
stacklevel=2,
792-
)
793-
super().__init__(metric)
794-
795-
796-
class InsightAttribute(VisualizationAttribute):
797-
def __init__(self, attribute: dict[str, Any]) -> None:
798-
warn(
799-
"This class is deprecated and it will be removed in v1.20.0 release. "
800-
"Please use 'VisualizationAttribute' class instead.",
801-
DeprecationWarning,
802-
stacklevel=2,
803-
)
804-
super().__init__(attribute)
805-
806-
807-
class InsightTotal(VisualizationTotal):
808-
def __init__(self, total: dict[str, Any]) -> None:
809-
warn(
810-
"This class is deprecated and it will be removed in v1.20.0 release. "
811-
"Please use 'VisualizationTotal' class instead.",
812-
DeprecationWarning,
813-
stacklevel=2,
814-
)
815-
super().__init__(total)
816-
817-
818-
class InsightFilter(VisualizationFilter):
819-
def __init__(self, f: dict[str, Any]) -> None:
820-
warn(
821-
"This class is deprecated and it will be removed in v1.20.0 release. "
822-
"Please use 'VisualizationFilter' class instead.",
823-
DeprecationWarning,
824-
stacklevel=2,
825-
)
826-
super().__init__(f)
827-
828-
829-
class InsightBucket(VisualizationBucket):
830-
def __init__(self, bucket: dict[str, Any]) -> None:
831-
warn(
832-
"This class is deprecated and it will be removed in v1.20.0 release. "
833-
"Please use 'VisualizationBucket' class instead.",
834-
DeprecationWarning,
835-
stacklevel=2,
836-
)
837-
super().__init__(bucket)
838-
839-
840-
class Insight(Visualization):
841-
def __init__(
842-
self,
843-
from_vis_obj: dict[str, Any],
844-
side_loads: Optional[SideLoads] = None,
845-
) -> None:
846-
warn(
847-
"This class is deprecated and it will be removed in v1.20.0 release. "
848-
"Please use 'Visualization' class instead.",
849-
DeprecationWarning,
850-
stacklevel=2,
851-
)
852-
super().__init__(from_vis_obj, side_loads)
853-
854-
855-
class InsightService(VisualizationService):
856-
def __init__(self, api_client: GoodDataApiClient) -> None:
857-
warn(
858-
"This class is deprecated and it will be removed in v1.20.0 release. "
859-
"Please use 'VisualizationService' class instead.",
860-
DeprecationWarning,
861-
stacklevel=2,
862-
)
863-
super().__init__(api_client)

gooddata-sdk/tests/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There are three important things to remember:
2727

2828
### Type conversion tests
2929

30-
There are a bunch of tests in [compute_model](./compute_model) and [insight](./visualization) whose purpose is to verify
30+
There are a bunch of tests in [compute_model](./compute_model) and [visualization](./visualization) whose purpose is to verify
3131
that conversion from internal models to the API models (stored in gooddata-api-client) work
3232
as intended.
3333

0 commit comments

Comments
 (0)