gooddata-pandas 1.43.1.dev3__tar.gz → 1.44.1.dev1__tar.gz
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-1.43.1.dev3/gooddata_pandas.egg-info → gooddata_pandas-1.44.1.dev1}/PKG-INFO +3 -3
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/data_access.py +25 -19
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/dataframe.py +60 -12
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/series.py +11 -2
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1/gooddata_pandas.egg-info}/PKG-INFO +3 -3
- gooddata_pandas-1.44.1.dev1/gooddata_pandas.egg-info/requires.txt +2 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/setup.py +3 -3
- gooddata_pandas-1.43.1.dev3/gooddata_pandas.egg-info/requires.txt +0 -2
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/LICENSE.txt +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/MANIFEST.in +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/README.md +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/__init__.py +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/_version.py +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/good_pandas.py +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/py.typed +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/result_convertor.py +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/utils.py +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas.egg-info/SOURCES.txt +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas.egg-info/dependency_links.txt +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas.egg-info/top_level.txt +0 -0
- {gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/setup.cfg +0 -0
{gooddata_pandas-1.43.1.dev3/gooddata_pandas.egg-info → gooddata_pandas-1.44.1.dev1}/PKG-INFO
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gooddata-pandas
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.44.1.dev1
|
|
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.
|
|
8
|
+
Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.44.1.dev1
|
|
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
|
|
@@ -23,7 +23,7 @@ Classifier: Typing :: Typed
|
|
|
23
23
|
Requires-Python: >=3.9.0
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE.txt
|
|
26
|
-
Requires-Dist: gooddata-sdk~=1.
|
|
26
|
+
Requires-Dist: gooddata-sdk~=1.44.1.dev1
|
|
27
27
|
Requires-Dist: pandas<3.0.0,>=2.0.0
|
|
28
28
|
Dynamic: author
|
|
29
29
|
Dynamic: author-email
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# (C) 2021 GoodData Corporation
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Any, Optional, Union
|
|
4
|
+
from typing import Any, Callable, Optional, Union
|
|
5
5
|
|
|
6
6
|
from gooddata_sdk import (
|
|
7
7
|
Attribute,
|
|
8
8
|
AttributeFilter,
|
|
9
9
|
CatalogAttribute,
|
|
10
|
+
Execution,
|
|
10
11
|
ExecutionDefinition,
|
|
11
|
-
ExecutionResponse,
|
|
12
12
|
Filter,
|
|
13
13
|
GoodDataSdk,
|
|
14
14
|
Metric,
|
|
@@ -257,7 +257,7 @@ def _compute(
|
|
|
257
257
|
columns: ColumnsDef,
|
|
258
258
|
index_by: Optional[IndexDef] = None,
|
|
259
259
|
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
260
|
-
) -> tuple[
|
|
260
|
+
) -> tuple[Execution, dict[str, int], dict[str, int], dict[str, int]]:
|
|
261
261
|
"""
|
|
262
262
|
Internal function that computes an execution-by-convention to retrieve data for a data frame with the provided
|
|
263
263
|
columns, optionally indexed by the index_by label and optionally filtered.
|
|
@@ -271,7 +271,7 @@ def _compute(
|
|
|
271
271
|
|
|
272
272
|
Returns:
|
|
273
273
|
tuple: A tuple containing the following elements:
|
|
274
|
-
-
|
|
274
|
+
- Execution: The execution response.
|
|
275
275
|
- dict[str, int]: A mapping of pandas column names to attribute dimension indices.
|
|
276
276
|
- dict[str, int]: A mapping of pandas column names to metric dimension indices.
|
|
277
277
|
- dict[str, int]: A mapping of pandas index names to attribute dimension indices.
|
|
@@ -299,20 +299,20 @@ _RESULT_PAGE_LEN = 1000
|
|
|
299
299
|
#
|
|
300
300
|
|
|
301
301
|
|
|
302
|
-
def _extract_for_metrics_only(
|
|
302
|
+
def _extract_for_metrics_only(execution: Execution, cols: list, col_to_metric_idx: dict) -> dict:
|
|
303
303
|
"""
|
|
304
304
|
Internal function that extracts data for metrics-only columns when there are no attribute columns.
|
|
305
305
|
|
|
306
306
|
Args:
|
|
307
|
-
|
|
307
|
+
execution (Execution): The execution response to extract data from.
|
|
308
308
|
cols (list): A list of column names.
|
|
309
309
|
col_to_metric_idx (dict): A mapping of pandas column names to metric dimension indices.
|
|
310
310
|
|
|
311
311
|
Returns:
|
|
312
312
|
dict: A dictionary containing the extracted data.
|
|
313
313
|
"""
|
|
314
|
-
exec_def =
|
|
315
|
-
result =
|
|
314
|
+
exec_def = execution.exec_def
|
|
315
|
+
result = execution.read_result(len(exec_def.metrics))
|
|
316
316
|
if len(result.data) == 0:
|
|
317
317
|
return {col: [] for col in cols}
|
|
318
318
|
|
|
@@ -345,7 +345,7 @@ def _typed_result(attributes: list[CatalogAttribute], attribute: Attribute, resu
|
|
|
345
345
|
|
|
346
346
|
|
|
347
347
|
def _extract_from_attributes_and_maybe_metrics(
|
|
348
|
-
|
|
348
|
+
execution: Execution,
|
|
349
349
|
attributes: list[CatalogAttribute],
|
|
350
350
|
cols: list[str],
|
|
351
351
|
col_to_attr_idx: dict[str, int],
|
|
@@ -357,7 +357,7 @@ def _extract_from_attributes_and_maybe_metrics(
|
|
|
357
357
|
optionally metrics columns.
|
|
358
358
|
|
|
359
359
|
Args:
|
|
360
|
-
|
|
360
|
+
execution (Execution): The execution response to extract data from.
|
|
361
361
|
attributes (list[CatalogAttribute]): The catalog of attributes.
|
|
362
362
|
cols (list[str]): A list of column names.
|
|
363
363
|
col_to_attr_idx (dict[str, int]): A mapping of pandas column names to attribute dimension indices.
|
|
@@ -370,11 +370,11 @@ def _extract_from_attributes_and_maybe_metrics(
|
|
|
370
370
|
- dict: A dictionary containing the extracted data.
|
|
371
371
|
- dict: A dictionary containing the extracted index data.
|
|
372
372
|
"""
|
|
373
|
-
exec_def =
|
|
373
|
+
exec_def = execution.exec_def
|
|
374
374
|
offset = [0 for _ in exec_def.dimensions]
|
|
375
375
|
limit = [len(exec_def.metrics), _RESULT_PAGE_LEN] if exec_def.has_metrics() else [_RESULT_PAGE_LEN]
|
|
376
376
|
attribute_dim = 1 if exec_def.has_metrics() else 0
|
|
377
|
-
result =
|
|
377
|
+
result = execution.read_result(limit=limit, offset=offset)
|
|
378
378
|
safe_index_to_attr_idx = index_to_attr_idx if index_to_attr_idx is not None else dict()
|
|
379
379
|
|
|
380
380
|
# mappings from column name to Attribute
|
|
@@ -401,7 +401,7 @@ def _extract_from_attributes_and_maybe_metrics(
|
|
|
401
401
|
break
|
|
402
402
|
|
|
403
403
|
offset[attribute_dim] = result.next_page_start(attribute_dim)
|
|
404
|
-
result =
|
|
404
|
+
result = execution.read_result(limit=limit, offset=offset)
|
|
405
405
|
|
|
406
406
|
return data, index
|
|
407
407
|
|
|
@@ -412,6 +412,7 @@ def compute_and_extract(
|
|
|
412
412
|
columns: ColumnsDef,
|
|
413
413
|
index_by: Optional[IndexDef] = None,
|
|
414
414
|
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
415
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
415
416
|
) -> tuple[dict, dict]:
|
|
416
417
|
"""
|
|
417
418
|
Convenience function that computes and extracts data from the execution response.
|
|
@@ -422,14 +423,16 @@ def compute_and_extract(
|
|
|
422
423
|
columns (ColumnsDef): The columns definition.
|
|
423
424
|
index_by (Optional[IndexDef]): The index definition, if any.
|
|
424
425
|
filter_by (Optional[Union[Filter, list[Filter]]]): A filter or a list of filters, if any.
|
|
426
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
427
|
+
submitted to the backend.
|
|
425
428
|
|
|
426
429
|
Returns:
|
|
427
430
|
tuple: A tuple containing the following dictionaries:
|
|
428
431
|
- dict: A dictionary with data for each column in `columns`.
|
|
429
432
|
- dict: A dictionary with data for constructing index(es) for each index in index_by.
|
|
430
433
|
|
|
431
|
-
Note: For convenience it is possible to pass just single index.
|
|
432
|
-
one key of '0' (just get first value from dict when consuming the result).
|
|
434
|
+
Note: For convenience, it is possible to pass just a single index. In that case, the index dict will contain exactly
|
|
435
|
+
one key of '0' (just get the first value from dict when consuming the result).
|
|
433
436
|
"""
|
|
434
437
|
result = _compute(
|
|
435
438
|
sdk=sdk,
|
|
@@ -439,17 +442,20 @@ def compute_and_extract(
|
|
|
439
442
|
filter_by=filter_by,
|
|
440
443
|
)
|
|
441
444
|
|
|
442
|
-
|
|
445
|
+
execution, col_to_attr_idx, col_to_metric_idx, index_to_attr_idx = result
|
|
443
446
|
|
|
444
|
-
|
|
447
|
+
if on_execution_submitted is not None:
|
|
448
|
+
on_execution_submitted(execution)
|
|
449
|
+
|
|
450
|
+
exec_def = execution.exec_def
|
|
445
451
|
cols = list(columns.keys())
|
|
446
452
|
|
|
447
453
|
if not exec_def.has_attributes():
|
|
448
|
-
return _extract_for_metrics_only(
|
|
454
|
+
return _extract_for_metrics_only(execution, cols, col_to_metric_idx), dict()
|
|
449
455
|
else:
|
|
450
456
|
attributes = get_catalog_attributes_for_extract(sdk, workspace_id, exec_def.attributes)
|
|
451
457
|
return _extract_from_attributes_and_maybe_metrics(
|
|
452
|
-
|
|
458
|
+
execution,
|
|
453
459
|
attributes,
|
|
454
460
|
cols,
|
|
455
461
|
col_to_attr_idx,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# (C) 2021 GoodData Corporation
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Union
|
|
4
|
+
from typing import Callable, Optional, Union
|
|
5
5
|
|
|
6
6
|
import pandas
|
|
7
7
|
from gooddata_api_client import models
|
|
8
8
|
from gooddata_sdk import (
|
|
9
9
|
Attribute,
|
|
10
10
|
BareExecutionResponse,
|
|
11
|
+
Execution,
|
|
11
12
|
ExecutionDefinition,
|
|
12
13
|
Filter,
|
|
13
14
|
GoodDataSdk,
|
|
@@ -68,19 +69,25 @@ class DataFrameFactory:
|
|
|
68
69
|
self._workspace_id = workspace_id
|
|
69
70
|
|
|
70
71
|
def indexed(
|
|
71
|
-
self,
|
|
72
|
+
self,
|
|
73
|
+
index_by: IndexDef,
|
|
74
|
+
columns: ColumnsDef,
|
|
75
|
+
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
76
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
72
77
|
) -> pandas.DataFrame:
|
|
73
78
|
"""
|
|
74
79
|
Creates a data frame indexed by values of the label. The data frame columns will be created from either
|
|
75
80
|
metrics or other label values.
|
|
76
81
|
|
|
77
|
-
Note that depending on composition of the labels, the DataFrame's index may or may not be unique.
|
|
82
|
+
Note that depending on the composition of the labels, the DataFrame's index may or may not be unique.
|
|
78
83
|
|
|
79
84
|
Args:
|
|
80
85
|
index_by (IndexDef): One or more labels to index by.
|
|
81
86
|
columns (ColumnsDef): Dictionary mapping column name to its definition.
|
|
82
87
|
filter_by (Optional[Union[Filter, list[Filter]]]):
|
|
83
88
|
Optional filters to apply during computation on the server.
|
|
89
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
90
|
+
submitted to the backend.
|
|
84
91
|
|
|
85
92
|
Returns:
|
|
86
93
|
pandas.DataFrame: A DataFrame instance.
|
|
@@ -91,6 +98,7 @@ class DataFrameFactory:
|
|
|
91
98
|
columns=columns,
|
|
92
99
|
index_by=index_by,
|
|
93
100
|
filter_by=filter_by,
|
|
101
|
+
on_execution_submitted=on_execution_submitted,
|
|
94
102
|
)
|
|
95
103
|
|
|
96
104
|
_idx = make_pandas_index(index)
|
|
@@ -98,7 +106,10 @@ class DataFrameFactory:
|
|
|
98
106
|
return pandas.DataFrame(data=data, index=_idx)
|
|
99
107
|
|
|
100
108
|
def not_indexed(
|
|
101
|
-
self,
|
|
109
|
+
self,
|
|
110
|
+
columns: ColumnsDef,
|
|
111
|
+
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
112
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
102
113
|
) -> pandas.DataFrame:
|
|
103
114
|
"""
|
|
104
115
|
Creates a data frame with columns created from metrics and or labels.
|
|
@@ -107,21 +118,33 @@ class DataFrameFactory:
|
|
|
107
118
|
columns (ColumnsDef): Dictionary mapping column name to its definition.
|
|
108
119
|
filter_by (Optional[Union[Filter, list[Filter]]]): Optionally specify filters to apply during
|
|
109
120
|
computation on the server.
|
|
121
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
122
|
+
submitted to the backend.
|
|
110
123
|
|
|
111
124
|
Returns:
|
|
112
125
|
pandas.DataFrame: A DataFrame instance.
|
|
113
126
|
"""
|
|
114
127
|
|
|
115
|
-
data, _ = compute_and_extract(
|
|
128
|
+
data, _ = compute_and_extract(
|
|
129
|
+
self._sdk,
|
|
130
|
+
self._workspace_id,
|
|
131
|
+
columns=columns,
|
|
132
|
+
filter_by=filter_by,
|
|
133
|
+
on_execution_submitted=on_execution_submitted,
|
|
134
|
+
)
|
|
116
135
|
|
|
117
136
|
return pandas.DataFrame(data=data)
|
|
118
137
|
|
|
119
138
|
def for_items(
|
|
120
|
-
self,
|
|
139
|
+
self,
|
|
140
|
+
items: ColumnsDef,
|
|
141
|
+
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
142
|
+
auto_index: bool = True,
|
|
143
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
121
144
|
) -> pandas.DataFrame:
|
|
122
145
|
"""
|
|
123
146
|
Creates a data frame for named items. This is a convenience method that will create DataFrame with or
|
|
124
|
-
without index based on the context of the items that you pass.
|
|
147
|
+
without an index based on the context of the items that you pass.
|
|
125
148
|
|
|
126
149
|
Args:
|
|
127
150
|
items (ColumnsDef): Dictionary mapping item name to its definition.
|
|
@@ -129,6 +152,8 @@ class DataFrameFactory:
|
|
|
129
152
|
on the server.
|
|
130
153
|
auto_index (bool): Default True. Enables creation of DataFrame with index depending on the contents
|
|
131
154
|
of the items.
|
|
155
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
156
|
+
submitted to the backend.
|
|
132
157
|
|
|
133
158
|
Returns:
|
|
134
159
|
pandas.DataFrame: A DataFrame instance.
|
|
@@ -157,9 +182,15 @@ class DataFrameFactory:
|
|
|
157
182
|
index_by=resolved_attr_cols,
|
|
158
183
|
columns=resolved_measure_cols,
|
|
159
184
|
filter_by=filter_by,
|
|
185
|
+
on_execution_submitted=on_execution_submitted,
|
|
160
186
|
)
|
|
161
187
|
|
|
162
|
-
def for_visualization(
|
|
188
|
+
def for_visualization(
|
|
189
|
+
self,
|
|
190
|
+
visualization_id: str,
|
|
191
|
+
auto_index: bool = True,
|
|
192
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
193
|
+
) -> pandas.DataFrame:
|
|
163
194
|
"""
|
|
164
195
|
Creates a data frame with columns based on the content of the visualization with the provided identifier.
|
|
165
196
|
|
|
@@ -167,6 +198,8 @@ class DataFrameFactory:
|
|
|
167
198
|
visualization_id (str): Visualization identifier.
|
|
168
199
|
auto_index (bool): Default True. Enables creation of DataFrame with index depending on the contents
|
|
169
200
|
of the visualization.
|
|
201
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
202
|
+
submitted to the backend.
|
|
170
203
|
|
|
171
204
|
Returns:
|
|
172
205
|
pandas.DataFrame: A DataFrame instance.
|
|
@@ -181,22 +214,31 @@ class DataFrameFactory:
|
|
|
181
214
|
**{naming.col_name_for_metric(m): m.as_computable() for m in visualization.metrics},
|
|
182
215
|
}
|
|
183
216
|
|
|
184
|
-
return self.for_items(
|
|
217
|
+
return self.for_items(
|
|
218
|
+
columns, filter_by=filter_by, auto_index=auto_index, on_execution_submitted=on_execution_submitted
|
|
219
|
+
)
|
|
185
220
|
|
|
186
221
|
def for_created_visualization(
|
|
187
|
-
self,
|
|
222
|
+
self,
|
|
223
|
+
created_visualizations_response: dict,
|
|
224
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
188
225
|
) -> tuple[pandas.DataFrame, DataFrameMetadata]:
|
|
189
226
|
"""
|
|
190
227
|
Creates a data frame using a created visualization.
|
|
191
228
|
|
|
192
229
|
Args:
|
|
193
230
|
created_visualizations_response (dict): Created visualization response.
|
|
231
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
232
|
+
submitted to the backend.
|
|
194
233
|
|
|
195
234
|
Returns:
|
|
196
235
|
pandas.DataFrame: A DataFrame instance.
|
|
197
236
|
"""
|
|
198
237
|
execution_definition = self._sdk.compute.build_exec_def_from_chat_result(created_visualizations_response)
|
|
199
|
-
return self.for_exec_def(
|
|
238
|
+
return self.for_exec_def(
|
|
239
|
+
exec_def=execution_definition,
|
|
240
|
+
on_execution_submitted=on_execution_submitted,
|
|
241
|
+
)
|
|
200
242
|
|
|
201
243
|
def result_cache_metadata_for_exec_result_id(self, result_id: str) -> ResultCacheMetadata:
|
|
202
244
|
"""
|
|
@@ -217,6 +259,7 @@ class DataFrameFactory:
|
|
|
217
259
|
result_size_dimensions_limits: ResultSizeDimensions = (),
|
|
218
260
|
result_size_bytes_limit: Optional[int] = None,
|
|
219
261
|
page_size: int = _DEFAULT_PAGE_SIZE,
|
|
262
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
220
263
|
) -> tuple[pandas.DataFrame, DataFrameMetadata]:
|
|
221
264
|
"""
|
|
222
265
|
Creates a data frame using an execution definition.
|
|
@@ -247,6 +290,8 @@ class DataFrameFactory:
|
|
|
247
290
|
result_size_dimensions_limits (ResultSizeDimensions): A tuple containing maximum size of result dimensions.
|
|
248
291
|
result_size_bytes_limit (Optional[int]): Maximum size of result in bytes.
|
|
249
292
|
page_size (int): Number of records per page.
|
|
293
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
294
|
+
submitted to the backend.
|
|
250
295
|
|
|
251
296
|
Returns:
|
|
252
297
|
Tuple[pandas.DataFrame, DataFrameMetadata]: Tuple holding DataFrame and DataFrame metadata.
|
|
@@ -257,6 +302,9 @@ class DataFrameFactory:
|
|
|
257
302
|
execution = self._sdk.compute.for_exec_def(workspace_id=self._workspace_id, exec_def=exec_def)
|
|
258
303
|
result_cache_metadata = self.result_cache_metadata_for_exec_result_id(execution.result_id)
|
|
259
304
|
|
|
305
|
+
if on_execution_submitted is not None:
|
|
306
|
+
on_execution_submitted(execution)
|
|
307
|
+
|
|
260
308
|
return convert_execution_response_to_dataframe(
|
|
261
309
|
execution_response=execution.bare_exec_response,
|
|
262
310
|
result_cache_metadata=result_cache_metadata,
|
|
@@ -302,7 +350,7 @@ class DataFrameFactory:
|
|
|
302
350
|
label_overrides (Optional[LabelOverrides]): Label overrides for metrics and attributes.
|
|
303
351
|
result_cache_metadata (Optional[ResultCacheMetadata]): Cache metadata for the execution result.
|
|
304
352
|
result_size_dimensions_limits (ResultSizeDimensions): A tuple containing maximum size of result dimensions.
|
|
305
|
-
result_size_bytes_limit (Optional[int]): Maximum size of result in bytes.
|
|
353
|
+
result_size_bytes_limit (Optional[int]): Maximum size of the result in bytes.
|
|
306
354
|
use_local_ids_in_headers (bool): Use local identifier in headers.
|
|
307
355
|
use_primary_labels_in_attributes (bool): Use primary labels in attributes.
|
|
308
356
|
page_size (int): Number of records per page.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# (C) 2021 GoodData Corporation
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Union
|
|
4
|
+
from typing import Callable, Optional, Union
|
|
5
5
|
|
|
6
6
|
import pandas
|
|
7
|
-
from gooddata_sdk import Attribute, Filter, GoodDataSdk, ObjId, SimpleMetric
|
|
7
|
+
from gooddata_sdk import Attribute, Execution, Filter, GoodDataSdk, ObjId, SimpleMetric
|
|
8
8
|
|
|
9
9
|
from gooddata_pandas.data_access import compute_and_extract
|
|
10
10
|
from gooddata_pandas.utils import IndexDef, LabelItemDef, make_pandas_index
|
|
@@ -28,6 +28,7 @@ class SeriesFactory:
|
|
|
28
28
|
index_by: IndexDef,
|
|
29
29
|
data_by: Union[SimpleMetric, str, ObjId, Attribute],
|
|
30
30
|
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
31
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
31
32
|
) -> pandas.Series:
|
|
32
33
|
"""Creates pandas Series from data points calculated from a single `data_by`.
|
|
33
34
|
|
|
@@ -61,6 +62,9 @@ class SeriesFactory:
|
|
|
61
62
|
- object identifier: ``ObjId(id='some_label_id', type='<type>')``
|
|
62
63
|
- Attribute or Metric depending on type of filter
|
|
63
64
|
|
|
65
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
66
|
+
submitted to the backend.
|
|
67
|
+
|
|
64
68
|
Returns:
|
|
65
69
|
pandas.Series: pandas series instance
|
|
66
70
|
"""
|
|
@@ -71,6 +75,7 @@ class SeriesFactory:
|
|
|
71
75
|
index_by=index_by,
|
|
72
76
|
columns={"_series": data_by},
|
|
73
77
|
filter_by=filter_by,
|
|
78
|
+
on_execution_submitted=on_execution_submitted,
|
|
74
79
|
)
|
|
75
80
|
|
|
76
81
|
_idx = make_pandas_index(index)
|
|
@@ -82,6 +87,7 @@ class SeriesFactory:
|
|
|
82
87
|
data_by: Union[SimpleMetric, str, ObjId, Attribute],
|
|
83
88
|
granularity: Optional[Union[list[LabelItemDef], IndexDef]] = None,
|
|
84
89
|
filter_by: Optional[Union[Filter, list[Filter]]] = None,
|
|
90
|
+
on_execution_submitted: Optional[Callable[[Execution], None]] = None,
|
|
85
91
|
) -> pandas.Series:
|
|
86
92
|
"""
|
|
87
93
|
Creates a pandas.Series from data points calculated from a single `data_by` without constructing an index.
|
|
@@ -108,6 +114,8 @@ class SeriesFactory:
|
|
|
108
114
|
- ObjId: ObjId(id='some_label_id', type='<type>')
|
|
109
115
|
- Attribute or Metric depending on the type of filter
|
|
110
116
|
Defaults to None.
|
|
117
|
+
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
|
|
118
|
+
submitted to the backend.
|
|
111
119
|
|
|
112
120
|
Returns:
|
|
113
121
|
pandas.Series: The resulting pandas Series instance.
|
|
@@ -124,6 +132,7 @@ class SeriesFactory:
|
|
|
124
132
|
index_by=_index,
|
|
125
133
|
columns={"_series": data_by},
|
|
126
134
|
filter_by=filter_by,
|
|
135
|
+
on_execution_submitted=on_execution_submitted,
|
|
127
136
|
)
|
|
128
137
|
|
|
129
138
|
return pandas.Series(data=data["_series"])
|
{gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1/gooddata_pandas.egg-info}/PKG-INFO
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gooddata-pandas
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.44.1.dev1
|
|
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.
|
|
8
|
+
Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.44.1.dev1
|
|
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
|
|
@@ -23,7 +23,7 @@ Classifier: Typing :: Typed
|
|
|
23
23
|
Requires-Python: >=3.9.0
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE.txt
|
|
26
|
-
Requires-Dist: gooddata-sdk~=1.
|
|
26
|
+
Requires-Dist: gooddata-sdk~=1.44.1.dev1
|
|
27
27
|
Requires-Dist: pandas<3.0.0,>=2.0.0
|
|
28
28
|
Dynamic: author
|
|
29
29
|
Dynamic: author-email
|
|
@@ -7,7 +7,7 @@ this_directory = Path(__file__).parent
|
|
|
7
7
|
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
|
8
8
|
|
|
9
9
|
REQUIRES = [
|
|
10
|
-
"gooddata-sdk~=1.
|
|
10
|
+
"gooddata-sdk~=1.44.1.dev1",
|
|
11
11
|
"pandas>=2.0.0,<3.0.0",
|
|
12
12
|
]
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ setup(
|
|
|
16
16
|
description="GoodData Cloud to pandas",
|
|
17
17
|
long_description=long_description,
|
|
18
18
|
long_description_content_type="text/markdown",
|
|
19
|
-
version="1.
|
|
19
|
+
version="1.44.1.dev1",
|
|
20
20
|
author="GoodData",
|
|
21
21
|
author_email="support@gooddata.com",
|
|
22
22
|
license="MIT",
|
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
packages=find_packages(exclude=["tests*"]),
|
|
27
27
|
python_requires=">=3.9.0",
|
|
28
28
|
project_urls={
|
|
29
|
-
"Documentation": "https://gooddata-pandas.readthedocs.io/en/v1.
|
|
29
|
+
"Documentation": "https://gooddata-pandas.readthedocs.io/en/v1.44.1.dev1",
|
|
30
30
|
"Source": "https://github.com/gooddata/gooddata-python-sdk",
|
|
31
31
|
},
|
|
32
32
|
classifiers=[
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas/result_convertor.py
RENAMED
|
File without changes
|
|
File without changes
|
{gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{gooddata_pandas-1.43.1.dev3 → gooddata_pandas-1.44.1.dev1}/gooddata_pandas.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|