gooddata-pandas 1.28.1.dev2__py3-none-any.whl → 1.28.1.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gooddata-pandas might be problematic. Click here for more details.
- gooddata_pandas/data_access.py +17 -9
- {gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/METADATA +3 -3
- {gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/RECORD +6 -6
- {gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/LICENSE.txt +0 -0
- {gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/WHEEL +0 -0
- {gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/top_level.txt +0 -0
gooddata_pandas/data_access.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Any, Optional, Union
|
|
|
6
6
|
from gooddata_sdk import (
|
|
7
7
|
Attribute,
|
|
8
8
|
AttributeFilter,
|
|
9
|
-
|
|
9
|
+
CatalogAttribute,
|
|
10
10
|
ExecutionDefinition,
|
|
11
11
|
ExecutionResponse,
|
|
12
12
|
Filter,
|
|
@@ -16,6 +16,7 @@ from gooddata_sdk import (
|
|
|
16
16
|
ObjId,
|
|
17
17
|
TableDimension,
|
|
18
18
|
)
|
|
19
|
+
from gooddata_sdk.utils import IdObjType
|
|
19
20
|
|
|
20
21
|
from gooddata_pandas.utils import (
|
|
21
22
|
ColumnsDef,
|
|
@@ -319,19 +320,26 @@ def _extract_for_metrics_only(response: ExecutionResponse, cols: list, col_to_me
|
|
|
319
320
|
return data
|
|
320
321
|
|
|
321
322
|
|
|
322
|
-
def
|
|
323
|
+
def _find_attribute(attributes: list[CatalogAttribute], id_obj: IdObjType) -> Union[CatalogAttribute, None]:
|
|
324
|
+
for attribute in attributes:
|
|
325
|
+
if attribute.find_label(id_obj) is not None:
|
|
326
|
+
return attribute
|
|
327
|
+
return None
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def _typed_result(attributes: list[CatalogAttribute], attribute: Attribute, result_values: list[Any]) -> list[Any]:
|
|
323
331
|
"""
|
|
324
332
|
Internal function to convert result_values to proper data types.
|
|
325
333
|
|
|
326
334
|
Args:
|
|
327
|
-
|
|
335
|
+
attributes (list[CatalogAttribute]): The catalog of attributes.
|
|
328
336
|
attribute (Attribute): The attribute for which the typed result will be computed.
|
|
329
337
|
result_values (list[Any]): A list of raw values.
|
|
330
338
|
|
|
331
339
|
Returns:
|
|
332
340
|
list[Any]: A list of converted values with proper data types.
|
|
333
341
|
"""
|
|
334
|
-
catalog_attribute =
|
|
342
|
+
catalog_attribute = _find_attribute(attributes, attribute.label)
|
|
335
343
|
if catalog_attribute is None:
|
|
336
344
|
raise ValueError(f"Unable to find attribute {attribute.label} in catalog")
|
|
337
345
|
return [_typed_attribute_value(catalog_attribute, value) for value in result_values]
|
|
@@ -339,7 +347,7 @@ def _typed_result(catalog: CatalogWorkspaceContent, attribute: Attribute, result
|
|
|
339
347
|
|
|
340
348
|
def _extract_from_attributes_and_maybe_metrics(
|
|
341
349
|
response: ExecutionResponse,
|
|
342
|
-
|
|
350
|
+
attributes: list[CatalogAttribute],
|
|
343
351
|
cols: list[str],
|
|
344
352
|
col_to_attr_idx: dict[str, int],
|
|
345
353
|
col_to_metric_idx: dict[str, int],
|
|
@@ -382,12 +390,12 @@ def _extract_from_attributes_and_maybe_metrics(
|
|
|
382
390
|
for idx_name in index:
|
|
383
391
|
rs = result.get_all_header_values(attribute_dim, safe_index_to_attr_idx[idx_name])
|
|
384
392
|
attribute = index_to_attribute[idx_name]
|
|
385
|
-
index[idx_name] += _typed_result(
|
|
393
|
+
index[idx_name] += _typed_result(attributes, attribute, rs)
|
|
386
394
|
for col in cols:
|
|
387
395
|
if col in col_to_attr_idx:
|
|
388
396
|
rs = result.get_all_header_values(attribute_dim, col_to_attr_idx[col])
|
|
389
397
|
attribute = col_to_attribute[col]
|
|
390
|
-
data[col] += _typed_result(
|
|
398
|
+
data[col] += _typed_result(attributes, attribute, rs)
|
|
391
399
|
elif col_to_metric_idx[col] < len(result.data):
|
|
392
400
|
data[col] += result.data[col_to_metric_idx[col]]
|
|
393
401
|
if result.is_complete(attribute_dim):
|
|
@@ -440,10 +448,10 @@ def compute_and_extract(
|
|
|
440
448
|
if not exec_def.has_attributes():
|
|
441
449
|
return _extract_for_metrics_only(response, cols, col_to_metric_idx), dict()
|
|
442
450
|
else:
|
|
443
|
-
|
|
451
|
+
attributes = sdk.catalog_workspace_content.get_attributes_catalog(workspace_id, include=["labels", "datasets"])
|
|
444
452
|
return _extract_from_attributes_and_maybe_metrics(
|
|
445
453
|
response,
|
|
446
|
-
|
|
454
|
+
attributes,
|
|
447
455
|
cols,
|
|
448
456
|
col_to_attr_idx,
|
|
449
457
|
col_to_metric_idx,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gooddata-pandas
|
|
3
|
-
Version: 1.28.1.
|
|
3
|
+
Version: 1.28.1.dev3
|
|
4
4
|
Summary: GoodData Cloud to pandas
|
|
5
5
|
Author: GoodData
|
|
6
6
|
Author-email: support@gooddata.com
|
|
7
7
|
License: MIT
|
|
8
|
-
Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.28.1.
|
|
8
|
+
Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.28.1.dev3
|
|
9
9
|
Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
|
|
10
10
|
Keywords: gooddata,pandas,series,data,frame,data_frame,analytics,headless,business,intelligence,headless-bi,cloud,native,semantic,layer,sql,metrics
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -22,7 +22,7 @@ Classifier: Typing :: Typed
|
|
|
22
22
|
Requires-Python: >=3.9.0
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.txt
|
|
25
|
-
Requires-Dist: gooddata-sdk ~=1.28.1.
|
|
25
|
+
Requires-Dist: gooddata-sdk ~=1.28.1.dev3
|
|
26
26
|
Requires-Dist: pandas <3.0.0,>=2.0.0
|
|
27
27
|
|
|
28
28
|
# GoodData Pandas
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
gooddata_pandas/__init__.py,sha256=Ta3qIIDq7kBRUsYSV3aC69AQBFvFvhtWDQucgP-l88w,297
|
|
2
2
|
gooddata_pandas/_version.py,sha256=960vTs6l7xsN2BOXWCxOc4PSKdzzKhnNEPTMnmMTCQs,119
|
|
3
|
-
gooddata_pandas/data_access.py,sha256=
|
|
3
|
+
gooddata_pandas/data_access.py,sha256=R5a6m9UoFzNO2lxeQkHvyCVkX0COZ3mfHz-B7kj2v24,19080
|
|
4
4
|
gooddata_pandas/dataframe.py,sha256=SeNIx-tlf7PjmGppkhNDPEl8RQN6BRKOC3UJ89uFnjo,13000
|
|
5
5
|
gooddata_pandas/good_pandas.py,sha256=ePEm2Lmeiftz5td0BLC71q7my5Aj8aABn3xV0myRmqI,3444
|
|
6
6
|
gooddata_pandas/py.typed,sha256=u_MS29sadlaIqGRPYFjWml5u0gQnoQfvbsf9pu3TZJU,94
|
|
7
7
|
gooddata_pandas/result_convertor.py,sha256=r7uFrjeM6cxMy08YcS3LywF1iUPSyEyG3BAddh0DkIQ,25807
|
|
8
8
|
gooddata_pandas/series.py,sha256=wTvJR_I0FUteyxo4RwHzP20eU7rei0dP8ZdqfrLbf5c,5759
|
|
9
9
|
gooddata_pandas/utils.py,sha256=JQZOuGjDfpPZqBnz-KdN8EwjzXXTbQCONWmUEE3cY9M,7217
|
|
10
|
-
gooddata_pandas-1.28.1.
|
|
11
|
-
gooddata_pandas-1.28.1.
|
|
12
|
-
gooddata_pandas-1.28.1.
|
|
13
|
-
gooddata_pandas-1.28.1.
|
|
14
|
-
gooddata_pandas-1.28.1.
|
|
10
|
+
gooddata_pandas-1.28.1.dev3.dist-info/LICENSE.txt,sha256=3RjzQk8y9HG1_LgqvbEqWZKJnTQGOO1cpzYzBc13Myk,149825
|
|
11
|
+
gooddata_pandas-1.28.1.dev3.dist-info/METADATA,sha256=ikQwYkAz7DoyiOfQPdaUIcrzvo3GYIY8f0pt19EaxqY,2843
|
|
12
|
+
gooddata_pandas-1.28.1.dev3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
13
|
+
gooddata_pandas-1.28.1.dev3.dist-info/top_level.txt,sha256=B7K_WFxlxplJbEbv5Mf0YhX74dbOpTPgDX-W6I7CssI,16
|
|
14
|
+
gooddata_pandas-1.28.1.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{gooddata_pandas-1.28.1.dev2.dist-info → gooddata_pandas-1.28.1.dev3.dist-info}/top_level.txt
RENAMED
|
File without changes
|