API Reference
- frame_to_hyper(df: pd.DataFrame, database: str | pathlib.Path, *, table: str | tableauhyperapi.Name | tableauhyperapi.TableName, table_mode: str = 'w', not_null_columns: Iterable[str] | None = None, json_columns: Iterable[str] | None = None, geo_columns: Iterable[str] | None = None) None:
Convert a DataFrame to a .hyper extract.
- Parameters:
df – Data to be written out.
database – Name / location of the Hyper file to write to.
table – Table to write to.
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.
not_null_columns – Columns which should be considered “NOT NULL” in the target Hyper database. By default, all columns are considered nullable
json_columns – Columns to be written as a JSON data type
geo_columns – Columns to be written as a GEOGRAPHY data type
- frame_from_hyper(source: str | pathlib.Path | tab_api.Connection, *, table: str | tableauhyperapi.Name | tableauhyperapi.TableName, return_type: Literal['pandas', 'pyarrow', 'polars'] = 'pandas')
Extracts a DataFrame from a .hyper extract.
- Parameters:
source – Name / location of the Hyper file to be read or Hyper-API connection.
table – Table to read.
return_type – The type of DataFrame to be returned
- frames_to_hyper(dict_of_frames: Dict[str | tableauhyperapi.Name | tableauhyperapi.TableName, pd.DataFrame], database: str | pathlib.Path, *, table_mode: str = 'w', not_null_columns: Iterable[str] | None = None, json_columns: Iterable[str] | None = None, geo_columns: Iterable[str] | None = None) None:
Writes multiple DataFrames to a .hyper extract.
- Parameters:
dict_of_frames – A dictionary whose keys are valid table identifiers and values are dataframes
database – Name / location of the Hyper file to write to.
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.
not_null_columns – Columns which should be considered “NOT NULL” in the target Hyper database. By default, all columns are considered nullable
json_columns – Columns to be written as a JSON data type
geo_columns – Columns to be written as a GEOGRAPHY data type
- frames_from_hyper(source: str | pathlib.Path | tab_api.Connection, *, return_type: Literal['pandas', 'pyarrow', 'polars'] = 'pandas') dict:
Extracts tables from a .hyper extract.
- Parameters:
source – Name / location of the Hyper file to be read or Hyper-API connection.
return_type – The type of DataFrame to be returned
- frame_from_hyper_query(source: str | pathlib.Path | tab_api.Connection, query: str, *, return_type: Literal['pandas', 'polars', 'pyarrow'] = 'pandas')
Executes a SQL query and returns the result as a pandas dataframe
- Parameters:
source – Name / location of the Hyper file to be read or Hyper-API connection.
query – SQL query to execute.
return_type – The type of DataFrame to be returned