Skip to content

sift_client.resources.assets

CLASS DESCRIPTION
AssetsAPIAsync

High-level API for interacting with assets.

AssetsAPIAsync

AssetsAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for interacting with assets.

This class provides a Pythonic, notebook-friendly interface for interacting with the AssetsAPI. It handles automatic handling of gRPC services, seamless type conversion, and clear error handling.

All methods in this class use the Asset class from the low-level wrapper, which is a user-friendly representation of an asset using standard Python data structures and types.

Initialize the AssetsAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
archive

Archive an asset.

find

Find a single asset matching the given query. Takes the same arguments as list_. If more than one asset is found,

get

Get an Asset.

list_

List assets with optional filtering.

update

Update an Asset.

archive async

archive(
    asset: str | Asset, *, archive_runs: bool = False
) -> Asset

Archive an asset.

PARAMETER DESCRIPTION
asset

The Asset or asset ID to archive.

TYPE: str | Asset

archive_runs

If True, archive all Runs associated with the Asset.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
Asset

The archived Asset.

find async

find(**kwargs) -> Asset | None

Find a single asset matching the given query. Takes the same arguments as list_. If more than one asset is found, raises an error.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments to pass to list_.

DEFAULT: {}

RETURNS DESCRIPTION
Asset | None

The Asset found or None.

get async

get(
    *, asset_id: str | None = None, name: str | None = None
) -> Asset

Get an Asset.

PARAMETER DESCRIPTION
asset_id

The ID of the asset.

TYPE: str | None DEFAULT: None

name

The name of the asset.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
Asset

The Asset.

list_ async

list_(
    *,
    name: str | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | None = None,
    asset_ids: list[str] | None = None,
    created_after: datetime | None = None,
    created_before: datetime | None = None,
    modified_after: datetime | None = None,
    modified_before: datetime | None = None,
    created_by: Any | None = None,
    modified_by: Any | None = None,
    tags: list[str] | None = None,
    tag_ids: list[str] | None = None,
    metadata: list[Any] | None = None,
    include_archived: bool = False,
    filter_query: str | None = None,
    order_by: str | None = None,
    limit: int | None = None,
) -> list[Asset]

List assets with optional filtering.

PARAMETER DESCRIPTION
asset_ids

List of asset IDs to filter by.

TYPE: list[str] | None DEFAULT: None

name

Exact name of the asset.

TYPE: str | None DEFAULT: None

name_contains

Partial name of the asset.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter assets by name.

TYPE: str | Pattern | None DEFAULT: None

asset_ids

List of asset IDs to filter by.

TYPE: list[str] | None DEFAULT: None

created_after

Created after this date.

TYPE: datetime | None DEFAULT: None

created_before

Created before this date.

TYPE: datetime | None DEFAULT: None

modified_after

Modified after this date.

TYPE: datetime | None DEFAULT: None

modified_before

Modified before this date.

TYPE: datetime | None DEFAULT: None

created_by

Assets created by this user.

TYPE: Any | None DEFAULT: None

modified_by

Assets last modified by this user.

TYPE: Any | None DEFAULT: None

tags

Assets with these tags.

TYPE: list[str] | None DEFAULT: None

tag_ids

List of asset tag IDs to filter by.

TYPE: list[str] | None DEFAULT: None

metadata

metadata filter

TYPE: list[Any] | None DEFAULT: None

include_archived

Include archived assets.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter assets.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved assets. # TODO: tooling for this?

TYPE: str | None DEFAULT: None

limit

How many assets to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[Asset]

A list of Assets that matches the filter.

update async

update(
    asset: str | Asset, update: AssetUpdate | dict
) -> Asset

Update an Asset.

PARAMETER DESCRIPTION
asset

The Asset or asset ID to update.

TYPE: str | Asset

update

Updates to apply to the Asset.

TYPE: AssetUpdate | dict

RETURNS DESCRIPTION
Asset

The updated Asset.