77from gooddata_sdk .utils import PROFILES_FILE_PATH , good_pandas_profile_content
88
99from gooddata_pandas import __version__
10+ from gooddata_pandas .arrow_types import ArrowConfig
1011from gooddata_pandas .dataframe import DataFrameFactory
1112from gooddata_pandas .series import SeriesFactory
1213
@@ -24,6 +25,8 @@ def __init__(
2425 host : str ,
2526 token : str ,
2627 headers_host : str | None = None ,
28+ use_arrow : bool = False ,
29+ arrow_config : ArrowConfig | None = None ,
2730 ** custom_headers_ : str | None ,
2831 ) -> None :
2932 """
@@ -33,12 +36,21 @@ def __init__(
3336 host (str): Host for GoodDataSdk.
3437 token (str): Token for GoodDataSdk.
3538 headers_host (Optional[str]): Host header, if needed.
39+ use_arrow (bool): When True, every DataFrameFactory created via
40+ :meth:`data_frames` uses the Arrow IPC binary endpoint instead of
41+ the JSON execution path. Requires pyarrow to be installed
42+ (``pip install gooddata-pandas[arrow]``). Defaults to False.
43+ arrow_config (Optional[ArrowConfig]): Arrow IPC conversion configuration
44+ shared across all DataFrameFactory instances created by this
45+ GoodPandas instance. Defaults to ArrowConfig() (safe defaults).
3646 **custom_headers_ (Optional[str]): Additional headers for GoodDataSdk.
3747
3848 """
3949 if headers_host is not None :
4050 custom_headers_ ["Host" ] = headers_host
4151 self ._sdk = GoodDataSdk .create (host , token , USER_AGENT , executions_cancellable = False , ** custom_headers_ )
52+ self ._use_arrow = use_arrow
53+ self ._arrow_config = arrow_config
4254 self ._series_per_ws : dict [str , SeriesFactory ] = dict ()
4355 self ._frames_per_ws : dict [str , DataFrameFactory ] = dict ()
4456
@@ -56,6 +68,8 @@ def create_from_profile(cls, profile: str = "default", profiles_path: Path = PRO
5668
5769 """
5870 content , custom_headers = good_pandas_profile_content (profile , profiles_path )
71+ if isinstance (content .get ("arrow_config" ), dict ):
72+ content ["arrow_config" ] = ArrowConfig (** content ["arrow_config" ])
5973 return cls (** content , ** custom_headers )
6074
6175 @property
@@ -97,6 +111,11 @@ def data_frames(self, workspace_id: str) -> DataFrameFactory:
97111
98112 """
99113 if workspace_id not in self ._frames_per_ws :
100- self ._frames_per_ws [workspace_id ] = DataFrameFactory (sdk = self ._sdk , workspace_id = workspace_id )
114+ self ._frames_per_ws [workspace_id ] = DataFrameFactory (
115+ sdk = self ._sdk ,
116+ workspace_id = workspace_id ,
117+ use_arrow = self ._use_arrow ,
118+ arrow_config = self ._arrow_config ,
119+ )
101120
102121 return self ._frames_per_ws [workspace_id ]
0 commit comments