Skip to main content

aip_sdk.get_current_snapshot_id

aip_sdk.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_id str: Dataset ID.
  • client APIClient | None: Optional API client.

Returns

  • str | None: Most-recent snapshot ID as a string, or None.