gooddata-pandas 1.17.0__py3-none-any.whl → 1.18.0__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.

@@ -269,6 +269,7 @@ class DataFrameFactory:
269
269
  result_size_dimensions_limits: ResultSizeDimensions = (),
270
270
  result_size_bytes_limit: Optional[int] = None,
271
271
  use_local_ids_in_headers: bool = False,
272
+ use_primary_labels_in_attributes: bool = False,
272
273
  page_size: int = _DEFAULT_PAGE_SIZE,
273
274
  ) -> Tuple[pandas.DataFrame, DataFrameMetadata]:
274
275
  """
@@ -298,6 +299,7 @@ class DataFrameFactory:
298
299
  result_size_dimensions_limits (ResultSizeDimensions): A tuple containing maximum size of result dimensions.
299
300
  result_size_bytes_limit (Optional[int]): Maximum size of result in bytes.
300
301
  use_local_ids_in_headers (bool): Use local identifier in headers.
302
+ use_primary_labels_in_attributes (bool): Use primary labels in attributes.
301
303
  page_size (int): Number of records per page.
302
304
 
303
305
  Returns:
@@ -322,5 +324,6 @@ class DataFrameFactory:
322
324
  result_size_dimensions_limits=result_size_dimensions_limits,
323
325
  result_size_bytes_limit=result_size_bytes_limit,
324
326
  use_local_ids_in_headers=use_local_ids_in_headers,
327
+ use_primary_labels_in_attributes=use_primary_labels_in_attributes,
325
328
  page_size=page_size,
326
329
  )
@@ -306,6 +306,7 @@ def _create_header_mapper(
306
306
  dim: int,
307
307
  label_overrides: Optional[LabelOverrides] = None,
308
308
  use_local_ids_in_headers: bool = False,
309
+ use_primary_labels_in_attributes: bool = False,
309
310
  ) -> Callable[[Any, Optional[int]], Optional[str]]:
310
311
  """
311
312
  Prepares a header mapper function which translates header structures into appropriate labels used
@@ -317,6 +318,7 @@ def _create_header_mapper(
317
318
  label_overrides (Optional[LabelOverrides]): Label overrides. Defaults to None.
318
319
  use_local_ids_in_headers (bool): Use local identifiers of header attributes and metrics. Optional.
319
320
  Defaults to False.
321
+ use_primary_labels_in_attributes (bool): Use primary labels in attributes. Optional. Defaults to False.
320
322
 
321
323
  Returns:
322
324
  Callable[[Any, Optional[int]], Optional[str]]: Mapper function.
@@ -334,7 +336,10 @@ def _create_header_mapper(
334
336
  pass
335
337
  elif "attributeHeader" in header:
336
338
  if "labelValue" in header["attributeHeader"]:
337
- label = header["attributeHeader"]["labelValue"]
339
+ if use_primary_labels_in_attributes:
340
+ label = header["attributeHeader"]["primaryLabelValue"]
341
+ else:
342
+ label = header["attributeHeader"]["labelValue"]
338
343
  # explicitly handle '(empty value)' if it's None otherwise it's not recognizable in final MultiIndex
339
344
  # backend represents ^^^ by "" (datasource value is "") or None (datasource value is NULL) therefore
340
345
  # if both representation are used it's necessary to set label to unique header label (space) to avoid
@@ -376,6 +381,7 @@ def _headers_to_index(
376
381
  response: BareExecutionResponse,
377
382
  label_overrides: LabelOverrides,
378
383
  use_local_ids_in_headers: bool = False,
384
+ use_primary_labels_in_attributes: bool = False,
379
385
  ) -> Optional[pandas.Index]:
380
386
  """Converts headers to a pandas MultiIndex.
381
387
 
@@ -388,6 +394,8 @@ def _headers_to_index(
388
394
  response (BareExecutionResponse): The execution response object with all data.
389
395
  label_overrides (LabelOverrides): A dictionary containing label overrides for the headers.
390
396
  use_local_ids_in_headers (bool, optional): If True, uses local Ids in headers, otherwise not. Defaults to False.
397
+ use_primary_labels_in_attributes (bool, optional): If True, uses primary labels in attributes, otherwise not.
398
+ Defaults to False.
391
399
 
392
400
  Returns:
393
401
  Optional[pandas.Index]: A pandas MultiIndex object created from the headers, or None if the headers are empty.
@@ -400,6 +408,7 @@ def _headers_to_index(
400
408
  dim=dim_idx,
401
409
  label_overrides=label_overrides,
402
410
  use_local_ids_in_headers=use_local_ids_in_headers,
411
+ use_primary_labels_in_attributes=use_primary_labels_in_attributes,
403
412
  )
404
413
 
405
414
  return pandas.MultiIndex.from_arrays(
@@ -467,6 +476,7 @@ def convert_execution_response_to_dataframe(
467
476
  result_size_dimensions_limits: ResultSizeDimensions,
468
477
  result_size_bytes_limit: Optional[int] = None,
469
478
  use_local_ids_in_headers: bool = False,
479
+ use_primary_labels_in_attributes: bool = False,
470
480
  page_size: int = _DEFAULT_PAGE_SIZE,
471
481
  ) -> Tuple[pandas.DataFrame, DataFrameMetadata]:
472
482
  """
@@ -480,6 +490,8 @@ def convert_execution_response_to_dataframe(
480
490
  result_size_dimensions_limits (ResultSizeDimensions): Dimension limits for the dataframe.
481
491
  result_size_bytes_limit (Optional[int], default=None): Size limit in bytes for the dataframe.
482
492
  use_local_ids_in_headers (bool, default=False): Use local ids in headers if True, else use default settings.
493
+ use_primary_labels_in_attributes (bool, default=False): Use primary labels in attributes if True, else use
494
+ default settings.
483
495
  page_size (int, default=_DEFAULT_PAGE_SIZE): Size of the page.
484
496
 
485
497
  Returns:
@@ -503,6 +515,7 @@ def convert_execution_response_to_dataframe(
503
515
  response=execution_response,
504
516
  label_overrides=label_overrides,
505
517
  use_local_ids_in_headers=use_local_ids_in_headers,
518
+ use_primary_labels_in_attributes=use_primary_labels_in_attributes,
506
519
  ),
507
520
  columns=_headers_to_index(
508
521
  dim_idx=1,
@@ -510,6 +523,7 @@ def convert_execution_response_to_dataframe(
510
523
  response=execution_response,
511
524
  label_overrides=label_overrides,
512
525
  use_local_ids_in_headers=use_local_ids_in_headers,
526
+ use_primary_labels_in_attributes=use_primary_labels_in_attributes,
513
527
  ),
514
528
  )
515
529
 
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gooddata-pandas
3
- Version: 1.17.0
3
+ Version: 1.18.0
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.17.0
8
+ Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.18.0
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.8.0
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE.txt
25
- Requires-Dist: gooddata-sdk ~=1.17.0
25
+ Requires-Dist: gooddata-sdk ~=1.18.0
26
26
  Requires-Dist: pandas <2.0.0,>=1.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=YxaAwfP9Yw10sit_vyhVfHJQBAzUUwtm5p0BItfBFx8,225
3
3
  gooddata_pandas/data_access.py,sha256=X8NKYtwWKFEfXvgrUbybuQmg1cub5pAhFtDCFMyzffY,18748
4
- gooddata_pandas/dataframe.py,sha256=w0l5pugt7pGxxVtLMJ-wNgA6mG6UxsCYc_Fyhay4P7U,13191
4
+ gooddata_pandas/dataframe.py,sha256=ryKKhiZAY6vi-uuRB-Oar60X3ARo8EAow5P4Bq1ZcJk,13413
5
5
  gooddata_pandas/good_pandas.py,sha256=ePEm2Lmeiftz5td0BLC71q7my5Aj8aABn3xV0myRmqI,3444
6
6
  gooddata_pandas/py.typed,sha256=u_MS29sadlaIqGRPYFjWml5u0gQnoQfvbsf9pu3TZJU,94
7
- gooddata_pandas/result_convertor.py,sha256=oVQerbwDVLiXs9RcAGrNxklJPQ3VjPFrxFt9Cr5djQ4,23248
7
+ gooddata_pandas/result_convertor.py,sha256=jAHPQWhh9iWz---oSPSsmXRwlhLplrZhpVWbiJRYSHU,24197
8
8
  gooddata_pandas/series.py,sha256=wTvJR_I0FUteyxo4RwHzP20eU7rei0dP8ZdqfrLbf5c,5759
9
9
  gooddata_pandas/utils.py,sha256=PpkB6oWacRxYY9S-RbEZm9Jdblo4bgAzrmHzV9MlMPQ,7223
10
- gooddata_pandas-1.17.0.dist-info/LICENSE.txt,sha256=CTs8U6T7MmKBKFFiQYARwgCfWgUzdosq01DI298WFiY,77209
11
- gooddata_pandas-1.17.0.dist-info/METADATA,sha256=pZ3d9C6stWOotNJDgrXY6-B9RVV5R-8kRxgqO89wPMk,2827
12
- gooddata_pandas-1.17.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- gooddata_pandas-1.17.0.dist-info/top_level.txt,sha256=B7K_WFxlxplJbEbv5Mf0YhX74dbOpTPgDX-W6I7CssI,16
14
- gooddata_pandas-1.17.0.dist-info/RECORD,,
10
+ gooddata_pandas-1.18.0.dist-info/LICENSE.txt,sha256=CTs8U6T7MmKBKFFiQYARwgCfWgUzdosq01DI298WFiY,77209
11
+ gooddata_pandas-1.18.0.dist-info/METADATA,sha256=Hjz8FO67_dqgQL-MJ9GwXwCuRjDsN04vZZK-YMPAEfE,2827
12
+ gooddata_pandas-1.18.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ gooddata_pandas-1.18.0.dist-info/top_level.txt,sha256=B7K_WFxlxplJbEbv5Mf0YhX74dbOpTPgDX-W6I7CssI,16
14
+ gooddata_pandas-1.18.0.dist-info/RECORD,,