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.

unarchive

Unarchive an asset.

update

Update an Asset.

ATTRIBUTE DESCRIPTION
client

TYPE: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

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,
    names: list[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 | str | None = None,
    modified_by: Any | str | None = None,
    tags: list[Any] | list[str] | list[Tag] | None = None,
    metadata: list[Any] | None = None,
    description_contains: str | 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
name

Exact name of the asset.

TYPE: str | None DEFAULT: None

names

List of asset names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the asset.

TYPE: str | None DEFAULT: None

name_regex

Regular expression to filter assets by name.

TYPE: str | Pattern | None DEFAULT: None

asset_ids

Filter to assets with any of these Ids.

TYPE: list[str] | None DEFAULT: None

created_after

Filter assets created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter assets created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter assets modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter assets modified before this datetime.

TYPE: datetime | None DEFAULT: None

created_by

Filter assets created by this User or user ID.

TYPE: Any | str | None DEFAULT: None

modified_by

Filter assets last modified by this User or user ID.

TYPE: Any | str | None DEFAULT: None

tags

Filter assets with any of these Tags or tag names.

TYPE: list[Any] | list[str] | list[Tag] | None DEFAULT: None

metadata

Filter assets by metadata criteria.

TYPE: list[Any] | None DEFAULT: None

description_contains

Partial description of the asset.

TYPE: str | None DEFAULT: None

include_archived

If True, include archived assets in results.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter assets.

TYPE: str | None DEFAULT: None

order_by

Field and direction to order results by.

TYPE: str | None DEFAULT: None

limit

Maximum number of assets to return. If None, returns all matches.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[Asset]

A list of Asset objects that match the filter criteria.

unarchive async

unarchive(asset: str | Asset) -> Asset

Unarchive an asset.

PARAMETER DESCRIPTION
asset

The Asset or asset ID to unarchive.

TYPE: str | Asset

RETURNS DESCRIPTION
Asset

The unarchived Asset.

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.