Data tables
| Method | Description |
|---|---|
list_data_tables | List data tables. |
iter_data_tables | Iterate over data tables. |
get_data_table | Get a data table by SID. |
create_data_table_from_json | Create a data table from a raw JSON payload. |
create_data_table_from_csv | Create a data table from CSV content. |
create_data_table_from_sqlite | Create a data table from a SQLite database. |
create_data_table_from_dataframe | Create a data table from a pandas DataFrame. |
list_data_tables
list_data_tables(
*,
name: str | None = None,
folder: Folder | str | None = None,
limit: int | None = None,
deleted: bool = False,
after: str | None = None
) -> Page["DataTable"]
List data tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | None | Optional name filter. | None |
folder | Folder | str | None | Optional folder filter. | None |
limit | int | None | Maximum number of results to return. | None |
deleted | bool | Whether to include deleted data tables. | False |
after | str | None | Pagination cursor. | None |
Returns:
Page['DataTable']: A page of DataTable objects.
iter_data_tables
iter_data_tables(
*,
name: str | None = None,
folder: Folder | str | None = None,
deleted: bool = False
) -> Iterator["DataTable"]
Iterate over data tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | None | Optional name filter. | None |
folder | Folder | str | None | Optional folder filter. | None |
deleted | bool | Whether to include deleted data tables. | False |
Yields:
DataTable: DataTable objects.
get_data_table
get_data_table(
sid: str, *, revision: int | None = None, allow_deleted: bool = False
) -> DataTable
Get a data table by SID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid | str | The SID of the data table. | |
revision | int | None | Optional revision number. | None |
allow_deleted | bool | Whether to allow retrieving deleted data tables. | False |
Returns:
DataTable: The requested DataTable.
create_data_table_from_json
create_data_table_from_json(
*,
json_content: dict[str, Any] | bytes | str | None = None,
json_file_path: str | Path | None = None,
name: str | None = None,
folder: Folder | str | None = None,
description: str | None = None,
version: str | dict | None = None
) -> DataTable
Create a data table from a raw JSON payload.
Exactly one of json_content or json_file_path must be provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
json_content | dict[str, Any] | bytes | str | None | The data table payload as a dict, JSON bytes, or JSON string. | None |
json_file_path | str | Path | None | Path to a JSON file containing the data table payload. | None |
name | str | None | Optional name for the new project item. | None |
folder | Folder | str | None | Optional destination folder. | None |
description | str | None | Optional description for the new project item. | None |
version | str | dict | None | Optional version name str. Can also be a dict with the keys name and description to set a version description. | None |
Returns:
DataTable: The created DataTable.
create_data_table_from_csv
create_data_table_from_csv(
*,
csv_content: str | bytes | None = None,
csv_file_path: str | Path | None = None,
mappings: dict[str, list[dict[str, Any]]] | None = None,
name: str | None = None,
folder: Folder | str | None = None,
description: str | None = None,
version: str | dict | None = None
) -> DataTable
Create a data table from CSV content.
Exactly one of csv_content or csv_file_path must be provided.
When mappings are provided the CSV is converted into the encoded
SQLite payload expected by the JSON creation route.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_content | str | bytes | None | The CSV data as a string or bytes. | None |
csv_file_path | str | Path | None | Path to a CSV file. | None |
mappings | dict[str, list[dict[str, Any]]] | None | Optional column mappings used to annotate the CSV columns. | None |
name | str | None | Optional name for the new project item. | None |
folder | Folder | str | None | Optional destination folder. | None |
description | str | None | Optional description for the new project item. | None |
version | str | dict | None | Optional version name str. Can also be a dict with the keys name and description to set a version description. | None |
Returns:
DataTable: The created DataTable.
create_data_table_from_sqlite
create_data_table_from_sqlite(
*,
sqlite_content: bytes | None = None,
sqlite_file_path: str | Path | None = None,
mappings: dict[str, list[dict[str, Any]]] | None = None,
name: str | None = None,
folder: Folder | str | None = None,
description: str | None = None,
version: str | dict | None = None
) -> DataTable
Create a data table from a SQLite database.
Exactly one of sqlite_content or sqlite_file_path must be
provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sqlite_content | bytes | None | The SQLite database as bytes. | None |
sqlite_file_path | str | Path | None | Path to a SQLite file. | None |
mappings | dict[str, list[dict[str, Any]]] | None | Optional column mappings used to annotate the database columns. | None |
name | str | None | Optional name for the new project item. | None |
folder | Folder | str | None | Optional destination folder. | None |
description | str | None | Optional description for the new project item. | None |
version | str | dict | None | Optional version name str. Can also be a dict with the keys name and description to set a version description. | None |
Returns:
DataTable: The created DataTable.
create_data_table_from_dataframe
create_data_table_from_dataframe(
df: Any,
*,
mappings: dict[str, list[dict[str, Any]]] | None = None,
name: str | None = None,
folder: Folder | str | None = None,
description: str | None = None,
version: str | dict | None = None
) -> DataTable
Create a data table from a pandas DataFrame.
Without mappings the DataFrame is uploaded as CSV text. With mappings it is converted into the encoded SQLite payload required by the JSON creation route.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | Any | A pandas DataFrame whose rows represent the data table records. | |
mappings | dict[str, list[dict[str, Any]]] | None | Optional column mappings used to annotate the DataFrame columns. | None |
name | str | None | Optional name for the new project item. | None |
folder | Folder | str | None | Optional destination folder. | None |
description | str | None | Optional description for the new project item. | None |
version | str | dict | None | Optional version name str. Can also be a dict with the keys name and description to set a version description. | None |
Returns:
DataTable: The created DataTable.