aip_sdk.datasets
Dataset CRUD operations.
aip_sdk.datasets.CommitBatchRequest
aip_sdk.datasets.CommitBatchRequest
Request model for atomic batch row operations.
aip_sdk.datasets.CommitBatchRequest.adds
aip_sdk.datasets.CommitBatchRequest.adds: list[dict[str, Any]] | None = None
No docstring is defined in the source.
aip_sdk.datasets.CommitBatchRequest.current_snapshot_id
aip_sdk.datasets.CommitBatchRequest.current_snapshot_id: _SnapshotId = None
No docstring is defined in the source.
aip_sdk.datasets.CommitBatchRequest.deletes
aip_sdk.datasets.CommitBatchRequest.deletes: list[str] | None = None
No docstring is defined in the source.
aip_sdk.datasets.CommitBatchRequest.updates
aip_sdk.datasets.CommitBatchRequest.updates: dict[str, dict[str, Any]] | None = None
No docstring is defined in the source.
aip_sdk.datasets.DeleteRowsRequest
aip_sdk.datasets.DeleteRowsRequest
Request model for deleting rows.
aip_sdk.datasets.DeleteRowsRequest.current_snapshot_id
aip_sdk.datasets.DeleteRowsRequest.current_snapshot_id: _SnapshotId = None
No docstring is defined in the source.
aip_sdk.datasets.DeleteRowsRequest.row_ids
aip_sdk.datasets.DeleteRowsRequest.row_ids: list[str] = Field(..., min_length=1)
No docstring is defined in the source.
aip_sdk.datasets.InsertRowsRequest
aip_sdk.datasets.InsertRowsRequest
Request model for inserting rows.
aip_sdk.datasets.InsertRowsRequest.current_snapshot_id
aip_sdk.datasets.InsertRowsRequest.current_snapshot_id: _SnapshotId = None
No docstring is defined in the source.
aip_sdk.datasets.InsertRowsRequest.rows
aip_sdk.datasets.InsertRowsRequest.rows: list[dict[str, Any]] = Field(..., min_length=1)
No docstring is defined in the source.
aip_sdk.datasets.RowOperationResponse
aip_sdk.datasets.RowOperationResponse
Response model for row operations.
aip_sdk.datasets.RowOperationResponse.adds
aip_sdk.datasets.RowOperationResponse.adds: list[dict[str, Any]]
No docstring is defined in the source.
aip_sdk.datasets.RowOperationResponse.deletes
aip_sdk.datasets.RowOperationResponse.deletes: list[str]
No docstring is defined in the source.
aip_sdk.datasets.RowOperationResponse.updates
aip_sdk.datasets.RowOperationResponse.updates: dict[str, dict[str, Any]]
No docstring is defined in the source.
aip_sdk.datasets.UpdateRowsRequest
aip_sdk.datasets.UpdateRowsRequest
Request model for updating rows.
aip_sdk.datasets.UpdateRowsRequest.current_snapshot_id
aip_sdk.datasets.UpdateRowsRequest.current_snapshot_id: _SnapshotId = None
No docstring is defined in the source.
aip_sdk.datasets.UpdateRowsRequest.updates
aip_sdk.datasets.UpdateRowsRequest.updates: dict[str, dict[str, Any]] = Field(..., min_length=1)
No docstring is defined in the source.
aip_sdk.datasets.aload_dataset
async aip_sdk.datasets.aload_dataset(reference: str | None = None, *, id: str | None = None, client: APIClient | None = None, workspace_id: str | None = None, all_workspaces: bool = False) -> Dataset
Async variant of load_dataset().
Reads your session's workspace unless you name one, and raises if none is set.
Pass all_workspaces=True to read across every workspace you can access.
Parameters
referencestr | None: Dataset name. The"name@vN"syntax is not supported (version pinning not yet implemented). UUID lookup requiresid=.idstr | None: Dataset UUID for direct ID lookup (keyword-only).clientAPIClient | None: Optional API client.workspace_idstr | None: Search only this workspace.all_workspacesbool: Search every workspace you can access.
Returns
Dataset: Dataset object.
Raises
DatasetNotFoundError: If the dataset does not exist.NotImplementedError: If a version reference ("name@vN") is passed.InvalidArgumentError: If neitherreferencenoridis provided.ForbiddenError: Ifworkspace_idnames a workspace you cannot access.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
Examples:
ds = await aip.aload_dataset("compliance-test-set")
ds = await aip.aload_dataset(id="uuid-...")
aip_sdk.datasets.commit_row_batch
aip_sdk.datasets.commit_row_batch(dataset_id: str, adds: list[dict[str, Any]] | None = None, updates: dict[str, dict[str, Any]] | None = None, deletes: list[str] | None = None, current_snapshot_id: str | int | None = None, client: APIClient | None = None) -> RowOperationResponse
Commit an atomic mix of insert / update / delete operations.
All operations are applied in a single Iceberg snapshot.
Parameters
dataset_idstr: Dataset ID.addslist[dict[str, Any]] | None: Rows to insert.updatesdict[str, dict[str, Any]] | None: Mapping of{row_id: {column: new_value}}.deleteslist[str] | None: Row IDs to delete.current_snapshot_idstr | int | None: Optional Iceberg snapshot ID for conflict detection. Accepts eitherstrorint; serialised as string to the API.clientAPIClient | None: Optional API client.
Returns
RowOperationResponse: class:RowOperationResponsewithadds,updates, anddeletesRowOperationResponse: fields reflecting the committed changes.
Raises
APIError: On HTTP error, including 409 whencurrent_snapshot_idmismatches.
aip_sdk.datasets.delete_dataset
aip_sdk.datasets.delete_dataset(dataset_id: str, *, client: APIClient | None = None) -> None
Permanently delete a dataset, all of its versions, and their stored files.
Irreversible and unprompted. To retire a dataset while keeping it readable,
use patch_dataset_status(dataset_id, "deprecated") instead.
Returning successfully means the dataset and its versions are gone. Purging the stored files is best-effort and completes after the deletion itself, so an object store outage can leave files behind for the platform to clean up.
Requires the workspace_admin or workspace_editor role.
Parameters
dataset_idstr: Dataset to delete.clientAPIClient | None: Optional API client.
Returns
None: None.
Raises
DatasetNotFoundError: If the dataset does not exist, or was already deleted.DatasetInUseError: If evaluation runs reference one of its versions, or another dataset was derived from it.ForbiddenError: If the caller lacks the workspace_admin or workspace_editor role.AuthError: If credentials are missing or invalid.
Examples:
try:
aip.delete_dataset("ds-abc123")
except aip.DatasetInUseError as err:
print(f"Still referenced by runs: {err.blocking_runs}")
aip_sdk.datasets.delete_rows
aip_sdk.datasets.delete_rows(dataset_id: str, row_ids: list[str], current_snapshot_id: str | int | None = None, client: APIClient | None = None) -> list[str]
Delete rows by row ID.
Parameters
dataset_idstr: Dataset ID.row_idslist[str]: List of row IDs to delete.current_snapshot_idstr | int | None: Optional Iceberg snapshot ID for conflict detection. Accepts eitherstrorint; serialised as string to the API.clientAPIClient | None: Optional API client.
Returns
list[str]: List of deleted row IDs.
Raises
APIError: On HTTP error, including 409 whencurrent_snapshot_idmismatches.
aip_sdk.datasets.get_current_snapshot_id
aip_sdk.datasets.get_current_snapshot_id(dataset_id: str, client: APIClient | None = None) -> str | None
Return the current Iceberg snapshot ID for a dataset.
Fetches GET /datasets/{id}/snapshots and returns the most-recent
snapshot ID, or None if the dataset has no snapshots yet.
Use this to seed current_snapshot_id on mutation calls for optimistic
conflict detection. The direct endpoint does not populate current_snapshot_id
after row mutations, so this helper exists to fetch it via the snapshots endpoint.
Parameters
dataset_idstr: Dataset ID.clientAPIClient | None: Optional API client.
Returns
str | None: Most-recent snapshot ID as a string, orNone.
aip_sdk.datasets.get_dataset
aip_sdk.datasets.get_dataset(dataset_id: str, client: APIClient | None = None) -> dict[str, Any]
Get dataset by ID.
Parameters
dataset_idstr: Dataset ID.clientAPIClient | None: Optional API client.
Returns
dict[str, Any]: Dataset record.
Raises
NotFoundError: If dataset does not exist.
aip_sdk.datasets.insert_rows
aip_sdk.datasets.insert_rows(dataset_id: str, rows: list[dict[str, Any]], current_snapshot_id: str | int | None = None, client: APIClient | None = None) -> list[dict[str, Any]]
Insert new rows into a dataset.
Parameters
dataset_idstr: Dataset ID.rowslist[dict[str, Any]]: List of row dicts (excluding_row_id, which is auto-generated).current_snapshot_idstr | int | None: Optional Iceberg snapshot ID for conflict detection. Accepts eitherstrorint; serialised as string to the API.clientAPIClient | None: Optional API client.
Returns
list[dict[str, Any]]: Inserted rows, each including the auto-generated_row_id.
Raises
APIError: On HTTP error, including 409 whencurrent_snapshot_idmismatches.
aip_sdk.datasets.list_datasets
aip_sdk.datasets.list_datasets(include_deprecated: bool = False, workspace_id: str | None = None, page: int = 1, per_page: int = 20, client: APIClient | None = None, *, all_workspaces: bool = False) -> list[Dataset]
List datasets, returning typed Dataset objects.
Reads your session's workspace unless you name one, and raises if none is set.
Pass all_workspaces=True to read across every workspace you can access.
Parameters
include_deprecatedbool: Include deprecated datasets.workspace_idstr | None: Return only datasets in this workspace.pageint: Page number (1-based).per_pageint: Items per page (max 100).clientAPIClient | None: Optional API client.all_workspacesbool: Read across every workspace you can access.
Returns
list[Dataset]: List of Dataset objects.
Raises
InvalidArgumentError: If bothworkspace_idandall_workspacesare given.ForbiddenError: Ifworkspace_idnames a workspace you cannot access.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
aip_sdk.datasets.list_versions
aip_sdk.datasets.list_versions(dataset_id: str, page: int = 1, per_page: int = 20, client: APIClient | None = None) -> list[DatasetVersion]
List versions for a dataset.
Parameters
dataset_idstr: Dataset IDpageint: Page number (1-based)per_pageint: Items per page (max 100)clientAPIClient | None: Optional API client
Returns
list[DatasetVersion]: List of DatasetVersion instances
aip_sdk.datasets.load_dataset
aip_sdk.datasets.load_dataset(reference: str | None = None, *, id: str | None = None, client: APIClient | None = None, workspace_id: str | None = None, all_workspaces: bool = False) -> Dataset
Load a dataset by name or by UUID via id=.
A name search reads your session's workspace unless you name one, and raises if none
is set; pass all_workspaces=True to search every workspace you can access, where a
name used twice resolves arbitrarily. Lookup by id is unaffected.
Parameters
referencestr | None: Dataset name. Always treated as a name search — UUID lookup requiresid=. The"name@vN"syntax is not supported: version pinning is not yet implemented (useds.versions()to inspect available versions).idstr | None: Dataset UUID for directGET /datasets/{id}lookup (keyword-only).clientAPIClient | None: Optional API client.workspace_idstr | None: Search only this workspace.all_workspacesbool: Search every workspace you can access.
Returns
Dataset: Dataset object.
Raises
DatasetNotFoundError: If the dataset does not exist.NotImplementedError: If a version reference ("name@vN") is passed.InvalidArgumentError: If neitherreferencenoridis provided.AuthError: If credentials are missing or invalid.ForbiddenError: Ifworkspace_idnames a workspace you cannot access.NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, andall_workspaceswas not set.
Examples:
ds = aip.load_dataset("compliance-test-set") # by name
ds = aip.load_dataset(id="uuid-...") # by UUID
df = ds.download()
aip_sdk.datasets.patch_dataset_status
aip_sdk.datasets.patch_dataset_status(dataset_id: str, status: str, client: APIClient | None = None) -> dict[str, Any]
Transition dataset status (admin only).
Valid transitions:
- pending → active
- pending → failed
- failed → pending
- active → deprecated
Parameters
dataset_idstr: Dataset IDstatusstr: Target statusclientAPIClient | None: Optional API client
Returns
dict[str, Any]: Updated dataset record
Raises
ForbiddenError: If caller is not adminUnprocessableEntityError: If transition is invalid
aip_sdk.datasets.update_rows
aip_sdk.datasets.update_rows(dataset_id: str, updates: dict[str, dict[str, Any]], current_snapshot_id: str | int | None = None, client: APIClient | None = None) -> dict[str, dict[str, Any]]
Update existing rows by row ID.
Parameters
dataset_idstr: Dataset ID.updatesdict[str, dict[str, Any]]: Mapping of{row_id: {column: new_value, ...}}.current_snapshot_idstr | int | None: Optional Iceberg snapshot ID for conflict detection. Accepts eitherstrorint; serialised as string to the API.clientAPIClient | None: Optional API client.
Returns
dict[str, dict[str, Any]]: Updated rows keyed by row ID.
Raises
APIError: On HTTP error, including 409 whencurrent_snapshot_idmismatches.