gooddata-pandas 1.2.1a3__py3-none-any.whl → 1.3.1.dev1__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.

@@ -7,7 +7,12 @@ import pandas
7
7
 
8
8
  from gooddata_api_client import models
9
9
  from gooddata_pandas.data_access import compute_and_extract
10
- from gooddata_pandas.result_convertor import DataFrameMetadata, LabelOverrides, convert_execution_response_to_dataframe
10
+ from gooddata_pandas.result_convertor import (
11
+ _DEFAULT_PAGE_SIZE,
12
+ DataFrameMetadata,
13
+ LabelOverrides,
14
+ convert_execution_response_to_dataframe,
15
+ )
11
16
  from gooddata_pandas.utils import (
12
17
  ColumnsDef,
13
18
  DefaultInsightColumnNaming,
@@ -250,6 +255,7 @@ class DataFrameFactory:
250
255
  label_overrides: Optional[LabelOverrides] = None,
251
256
  result_size_dimensions_limits: ResultSizeDimensions = (),
252
257
  result_size_bytes_limit: Optional[int] = None,
258
+ page_size: int = _DEFAULT_PAGE_SIZE,
253
259
  ) -> Tuple[pandas.DataFrame, DataFrameMetadata]:
254
260
  """
255
261
  Creates a data frame using an execution definition. The data frame will respect the dimensionality
@@ -278,7 +284,7 @@ class DataFrameFactory:
278
284
  :param exec_def: execution definition
279
285
  :param label_overrides: label overrides for metrics and attributes
280
286
  :param result_size_dimensions_limits: A tuple containing maximum size of result dimensions. Optional.
281
- :param result_size_bytes_limits: Maximum size of result in bytes. Optional.
287
+ :param result_size_bytes_limit: Maximum size of result in bytes. Optional.
282
288
  :return: tuple holding DataFrame and DataFrame metadata
283
289
  """
284
290
  if label_overrides is None:
@@ -293,6 +299,7 @@ class DataFrameFactory:
293
299
  label_overrides=label_overrides,
294
300
  result_size_dimensions_limits=result_size_dimensions_limits,
295
301
  result_size_bytes_limit=result_size_bytes_limit,
302
+ page_size=page_size,
296
303
  )
297
304
 
298
305
  def for_exec_result_id(
@@ -303,6 +310,7 @@ class DataFrameFactory:
303
310
  result_size_dimensions_limits: ResultSizeDimensions = (),
304
311
  result_size_bytes_limit: Optional[int] = None,
305
312
  use_local_ids_in_headers: bool = False,
313
+ page_size: int = _DEFAULT_PAGE_SIZE,
306
314
  ) -> Tuple[pandas.DataFrame, DataFrameMetadata]:
307
315
  """
308
316
  Creates a data frame using an execution result's metadata identified by result_id. The data frame will respect
@@ -356,4 +364,5 @@ class DataFrameFactory:
356
364
  result_size_dimensions_limits=result_size_dimensions_limits,
357
365
  result_size_bytes_limit=result_size_bytes_limit,
358
366
  use_local_ids_in_headers=use_local_ids_in_headers,
367
+ page_size=page_size,
359
368
  )
@@ -1,12 +1,14 @@
1
1
  # (C) 2021 GoodData Corporation
2
2
  from __future__ import annotations
3
3
 
4
+ from pathlib import Path
4
5
  from typing import Optional
5
6
 
6
7
  from gooddata_pandas import __version__
7
8
  from gooddata_pandas.dataframe import DataFrameFactory
8
9
  from gooddata_pandas.series import SeriesFactory
9
10
  from gooddata_sdk import GoodDataSdk
11
+ from gooddata_sdk.utils import PROFILES_FILE_PATH, good_pandas_profile_content
10
12
 
11
13
  USER_AGENT = f"gooddata-pandas/{__version__}"
12
14
  """Extra segment of the User-Agent header that will be appended to standard gooddata-sdk user agent."""
@@ -30,6 +32,11 @@ class GoodPandas:
30
32
  self._series_per_ws: dict[str, SeriesFactory] = dict()
31
33
  self._frames_per_ws: dict[str, DataFrameFactory] = dict()
32
34
 
35
+ @classmethod
36
+ def create_from_profile(cls, profile: str = "default", profiles_path: Path = PROFILES_FILE_PATH) -> GoodPandas:
37
+ content, custom_headers = good_pandas_profile_content(profile, profiles_path)
38
+ return cls(**content, **custom_headers)
39
+
33
40
  @property
34
41
  def sdk(self) -> GoodDataSdk:
35
42
  return self._sdk
@@ -364,6 +364,7 @@ def convert_execution_response_to_dataframe(
364
364
  result_size_dimensions_limits: ResultSizeDimensions,
365
365
  result_size_bytes_limit: Optional[int] = None,
366
366
  use_local_ids_in_headers: bool = False,
367
+ page_size: int = _DEFAULT_PAGE_SIZE,
367
368
  ) -> Tuple[pandas.DataFrame, DataFrameMetadata]:
368
369
  """
369
370
  Converts execution result to a pandas dataframe, maintaining the dimensionality of the result.
@@ -380,6 +381,7 @@ def convert_execution_response_to_dataframe(
380
381
  result_cache_metadata=result_cache_metadata,
381
382
  result_size_dimensions_limits=result_size_dimensions_limits,
382
383
  result_size_bytes_limit=result_size_bytes_limit,
384
+ page_size=page_size,
383
385
  )
384
386
  full_data = _merge_grand_totals_into_data(extract)
385
387
  full_headers = _merge_grand_total_headers_into_headers(extract)
gooddata_pandas/utils.py CHANGED
@@ -75,7 +75,7 @@ def _to_attribute(val: LabelItemDef, local_id: Optional[str] = None) -> Attribut
75
75
 
76
76
 
77
77
  def _typed_attribute_value(ct_attr: CatalogAttribute, value: Any) -> Any:
78
- converter = AttributeConverterStore.find_converter(ct_attr.dataset.data_type, ct_attr.granularity)
78
+ converter = AttributeConverterStore.find_converter(ct_attr.dataset.dataset_type, ct_attr.granularity)
79
79
  return converter.to_external_type(value)
80
80
 
81
81
 
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gooddata-pandas
3
- Version: 1.2.1a3
3
+ Version: 1.3.1.dev1
4
4
  Summary: GoodData.CN 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.2.1a3
8
+ Project-URL: Documentation, https://gooddata-pandas.readthedocs.io/en/v1.3.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
@@ -22,7 +22,7 @@ Classifier: Typing :: Typed
22
22
  Requires-Python: >=3.7.0
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE.txt
25
- Requires-Dist: gooddata-sdk (~=1.2.1a3)
25
+ Requires-Dist: gooddata-sdk (~=1.3.1.dev1)
26
26
  Requires-Dist: pandas (<2.0.0,>=1.0.0)
27
27
  Requires-Dist: importlib-metadata (>=1.0) ; python_version >= "3.7"
28
28
 
@@ -0,0 +1,13 @@
1
+ gooddata_pandas/__init__.py,sha256=Ta3qIIDq7kBRUsYSV3aC69AQBFvFvhtWDQucgP-l88w,297
2
+ gooddata_pandas/_version.py,sha256=YxaAwfP9Yw10sit_vyhVfHJQBAzUUwtm5p0BItfBFx8,225
3
+ gooddata_pandas/data_access.py,sha256=gVEpzPPZPyjjYSwKxmCZtJpYrY4b1ptnipGZcXz-ovU,13090
4
+ gooddata_pandas/dataframe.py,sha256=N5z0mmQIS9D8TbcO1Qknqm7RkuKB3jTPv66F8onwTpg,16321
5
+ gooddata_pandas/good_pandas.py,sha256=BFfavMkLnCrK6IYijehAU23Z0-kSz7wOEnf0wp-RgP0,2495
6
+ gooddata_pandas/result_convertor.py,sha256=UqluA_RH_f32x-YIj95p_jfaZqvZDhl8fDeaWu-OU9A,17729
7
+ gooddata_pandas/series.py,sha256=6MrcMB2kLNtkf7XeaVfVKzS5n0HAZSSU-Dx_BzMzndQ,5545
8
+ gooddata_pandas/utils.py,sha256=3-DmE7A6yiAwAyaATv6WlGco0HXT9RY8omHv91IO3Ks,4248
9
+ gooddata_pandas-1.3.1.dev1.dist-info/LICENSE.txt,sha256=7kFpIrSFoeR3tktzAJD_OEtNUsnhbA0bW1YQMq6gJjg,78103
10
+ gooddata_pandas-1.3.1.dev1.dist-info/METADATA,sha256=sKpZE8VnBncTW2kJ7fBZ9zin3XjZYXpL8EdUDh81-RE,2907
11
+ gooddata_pandas-1.3.1.dev1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
12
+ gooddata_pandas-1.3.1.dev1.dist-info/top_level.txt,sha256=B7K_WFxlxplJbEbv5Mf0YhX74dbOpTPgDX-W6I7CssI,16
13
+ gooddata_pandas-1.3.1.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: bdist_wheel (0.40.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,13 +0,0 @@
1
- gooddata_pandas/__init__.py,sha256=Ta3qIIDq7kBRUsYSV3aC69AQBFvFvhtWDQucgP-l88w,297
2
- gooddata_pandas/_version.py,sha256=YxaAwfP9Yw10sit_vyhVfHJQBAzUUwtm5p0BItfBFx8,225
3
- gooddata_pandas/data_access.py,sha256=gVEpzPPZPyjjYSwKxmCZtJpYrY4b1ptnipGZcXz-ovU,13090
4
- gooddata_pandas/dataframe.py,sha256=NnxSiYOdvtC6wMo_9WHojs9OLVwZYx4CBrvQBNcXnoA,16125
5
- gooddata_pandas/good_pandas.py,sha256=AkAzJEOMkO8EXxcHIcAMO-jI3onDlFHRJ3f4aWA-gWg,2123
6
- gooddata_pandas/result_convertor.py,sha256=hIMLzJnQNZQ0n8AwixOCjJDz3tPyozQnvDSPgzu3c4Q,17659
7
- gooddata_pandas/series.py,sha256=6MrcMB2kLNtkf7XeaVfVKzS5n0HAZSSU-Dx_BzMzndQ,5545
8
- gooddata_pandas/utils.py,sha256=7kaQGxQTQw7OP6Sa6-RePJsuqgd5baPDHIxbein1PFA,4245
9
- gooddata_pandas-1.2.1a3.dist-info/LICENSE.txt,sha256=7kFpIrSFoeR3tktzAJD_OEtNUsnhbA0bW1YQMq6gJjg,78103
10
- gooddata_pandas-1.2.1a3.dist-info/METADATA,sha256=E_9ZGcPCAB-Lvhiy8egjmCRy5i8M50L8xw4cQEoBzjY,2898
11
- gooddata_pandas-1.2.1a3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
12
- gooddata_pandas-1.2.1a3.dist-info/top_level.txt,sha256=B7K_WFxlxplJbEbv5Mf0YhX74dbOpTPgDX-W6I7CssI,16
13
- gooddata_pandas-1.2.1a3.dist-info/RECORD,,