|
1 | 1 | API Reference
|
2 | 2 | =============
|
3 | 3 |
|
4 |
| -.. py:function:: frame_to_hyper(df: pd.DataFrame, database: Union[str, pathlib.Path], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], table_mode: str = "w", hyper_process: Optional[HyperProcess]) -> None: |
| 4 | +.. py:function:: frame_to_hyper(df: pd.DataFrame, database: Union[str, pathlib.Path], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], table_mode: str = "w", not_null_columns: Optional[Iterable[str]] = None, json_columns: Optional[Iterable[str]] = None, geo_columns: Optional[Iterable[str]] = None) -> None: |
5 | 5 |
|
6 | 6 | Convert a DataFrame to a .hyper extract.
|
7 | 7 |
|
8 | 8 | :param df: Data to be written out.
|
9 | 9 | :param database: Name / location of the Hyper file to write to.
|
10 |
| - :param table: Table to write to. Must be supplied as a keyword argument. |
| 10 | + :param table: Table to write to. |
11 | 11 | :param table_mode: The mode to open the table with. Default is "w" for write, which truncates the file before writing. Another option is "a", which will append data to the file if it already contains information.
|
12 |
| - :param hyper_process: A `HyperProcess` in case you want to spawn it by yourself. Optional. Must be supplied as a keyword argument. |
13 |
| - :param use_parquet: Use a temporary parquet file to write into the Hyper database, which typically will yield better performance. Boolean, default False |
| 12 | + :param not_null_columns: Columns which should be considered "NOT NULL" in the target Hyper database. By default, all columns are considered nullable |
| 13 | + :param json_columns: Columns to be written as a JSON data type |
| 14 | + :param geo_columns: Columns to be written as a GEOGRAPHY data type |
14 | 15 |
|
15 |
| - |
16 |
| -.. py:function:: frame_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], hyper_process: Optional[HyperProcess], use_float_na: bool = False) -> pd.DataFrame: |
| 16 | +.. py:function:: frame_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], return_type: Literal["pandas", "pyarrow", "polars"] = "pandas") |
17 | 17 |
|
18 | 18 | Extracts a DataFrame from a .hyper extract.
|
19 | 19 |
|
20 | 20 | :param source: Name / location of the Hyper file to be read or Hyper-API connection.
|
21 |
| - :param table: Table to read. Must be supplied as a keyword argument. |
22 |
| - :param hyper_process: A `HyperProcess` in case you want to spawn it by yourself. Optional. Must be supplied as a keyword argument. |
23 |
| - :param use_float_na: Flag indicating whether to use the pandas `Float32`/`Float64` dtypes which support the new pandas missing value `pd.NA`, default False |
24 |
| - :rtype: pd.DataFrame |
| 21 | + :param table: Table to read. |
| 22 | + :param return_type: The type of DataFrame to be returned |
25 | 23 |
|
26 | 24 |
|
27 |
| -.. py:function:: frames_to_hyper(dict_of_frames: Dict[Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], pd.DataFrame], database: Union[str, pathlib.Path], table_mode: str = "w", *, hyper_process: Optional[HyperProcess]) -> None: |
| 25 | +.. py:function:: frames_to_hyper(dict_of_frames: Dict[Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], pd.DataFrame], database: Union[str, pathlib.Path], *, table_mode: str = "w", not_null_columns: Optional[Iterable[str]] = None, json_columns: Optional[Iterable[str]] = None, geo_columns: Optional[Iterable[str]] = None,) -> None: |
28 | 26 |
|
29 | 27 | Writes multiple DataFrames to a .hyper extract.
|
30 | 28 |
|
31 | 29 | :param dict_of_frames: A dictionary whose keys are valid table identifiers and values are dataframes
|
32 | 30 | :param database: Name / location of the Hyper file to write to.
|
33 | 31 | :param table_mode: The mode to open the table with. Default is "w" for write, which truncates the file before writing. Another option is "a", which will append data to the file if it already contains information.
|
34 |
| - :param hyper_process: A `HyperProcess` in case you want to spawn it by yourself. Optional. Must be supplied as a keyword argument. |
35 |
| - :param use_parquet: Use a temporary parquet file to write into the Hyper database, which typically will yield better performance. Boolean, default False |
| 32 | + :param not_null_columns: Columns which should be considered "NOT NULL" in the target Hyper database. By default, all columns are considered nullable |
| 33 | + :param json_columns: Columns to be written as a JSON data type |
| 34 | + :param geo_columns: Columns to be written as a GEOGRAPHY data type |
36 | 35 |
|
37 |
| -.. py:function:: frames_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, hyper_process: Optional[HyperProcess]) -> Dict[tableauhyperapi.TableName, pd.DataFrame, use_float_na: bool = False]: |
| 36 | +.. py:function:: frames_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, return_type: Literal["pandas", "pyarrow", "polars"] = "pandas") -> dict: |
38 | 37 |
|
39 | 38 | Extracts tables from a .hyper extract.
|
40 | 39 |
|
41 | 40 | :param source: Name / location of the Hyper file to be read or Hyper-API connection.
|
42 |
| - :param hyper_process: A `HyperProcess` in case you want to spawn it by yourself. Optional. Must be supplied as a keyword argument. |
43 |
| - :param use_float_na: Flag indicating whether to use the pandas `Float32`/`Float64` dtypes which support the new pandas missing value `pd.NA`, default False |
44 |
| - :rtype: Dict[tableauhyperapi.TableName, pd.DataFrame] |
45 |
| - |
| 41 | + :param return_type: The type of DataFrame to be returned |
46 | 42 |
|
47 |
| -.. py:function:: frame_from_hyper_query(source: Union[str, pathlib.Path, tab_api.Connection], query: str, *, hyper_process: Optional[HyperProcess], use_float_na: bool = False) -> pd.DataFrame: |
48 | 43 |
|
49 |
| -.. versionadded:: 2.0 |
| 44 | +.. py:function:: frame_from_hyper_query(source: Union[str, pathlib.Path, tab_api.Connection], query: str, *, return_type: Literal["pandas", "polars", "pyarrow"] = "pandas",) |
50 | 45 |
|
51 | 46 | Executes a SQL query and returns the result as a pandas dataframe
|
52 | 47 |
|
53 | 48 | :param source: Name / location of the Hyper file to be read or Hyper-API connection.
|
54 | 49 | :param query: SQL query to execute.
|
55 |
| - :param hyper_process: A `HyperProcess` in case you want to spawn it by yourself. Optional. Must be supplied as a keyword argument. |
56 |
| - :param use_float_na: Flag indicating whether to use the pandas `Float32`/`Float64` dtypes which support the new pandas missing value `pd.NA`, default False |
57 |
| - :rtype: Dict[tableauhyperapi.TableName, pd.DataFrame] |
| 50 | + :param return_type: The type of DataFrame to be returned |
0 commit comments