Skip to content

sift_client.resources.calculated_channels

CLASS DESCRIPTION
CalculatedChannelsAPIAsync

High-level API for interacting with calculated channels.

CalculatedChannelsAPIAsync

CalculatedChannelsAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for interacting with calculated channels.

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

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

Initialize the CalculatedChannelsAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
archive

Archive a calculated channel.

create

Create a calculated channel.

find

Find a single calculated channel matching the given query. Takes the same arguments as list but handles checking for multiple matches.

get

Get a Calculated Channel.

list_

List calculated channels with optional filtering. This will return the latest version. To find all versions, use list_versions.

list_versions

List versions of a calculated channel.

unarchive

Unarchive a calculated channel.

update

Update a Calculated Channel.

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(
    calculated_channel: str | CalculatedChannel,
) -> CalculatedChannel

Archive a calculated channel.

PARAMETER DESCRIPTION
calculated_channel

The id or CalculatedChannel object of the calculated channel to archive.

TYPE: str | CalculatedChannel

RETURNS DESCRIPTION
CalculatedChannel

The archived CalculatedChannel.

create async

create(
    create: CalculatedChannelCreate | dict,
) -> CalculatedChannel

Create a calculated channel.

PARAMETER DESCRIPTION
create

A CalculatedChannelCreate object or dictionary with configuration for the new calculated channel. This should include properties like name, expression, channel_references, etc.

TYPE: CalculatedChannelCreate | dict

RETURNS DESCRIPTION
CalculatedChannel

The created CalculatedChannel.

find async

find(**kwargs) -> CalculatedChannel | None

Find a single calculated channel matching the given query. Takes the same arguments as list but handles checking for multiple matches. Will raise an error if multiple calculated channels are found.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments to pass to list_.

DEFAULT: {}

RETURNS DESCRIPTION
CalculatedChannel | None

The CalculatedChannel found or None.

get async

get(
    *,
    calculated_channel_id: str | None = None,
    client_key: str | None = None,
) -> CalculatedChannel

Get a Calculated Channel.

PARAMETER DESCRIPTION
calculated_channel_id

The ID of the calculated channel.

TYPE: str | None DEFAULT: None

client_key

The client key of the calculated channel.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
CalculatedChannel

The CalculatedChannel.

RAISES DESCRIPTION
ValueError

If neither calculated_channel_id nor client_key is provided.

list_ async

list_(
    *,
    name: str | None = None,
    names: list[str] | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | None = None,
    calculated_channel_ids: list[str] | None = None,
    client_keys: 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,
    asset: Asset | str | None = None,
    run: Run | str | None = None,
    version: int | 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[CalculatedChannel]

List calculated channels with optional filtering. This will return the latest version. To find all versions, use list_versions.

PARAMETER DESCRIPTION
name

Exact name of the calculated channel.

TYPE: str | None DEFAULT: None

names

List of calculated channel names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the calculated channel.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter calculated channels by name.

TYPE: str | Pattern | None DEFAULT: None

calculated_channel_ids

Filter to calculated channels with any of these IDs.

TYPE: list[str] | None DEFAULT: None

client_keys

Filter to calculated channels with any of these client keys.

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

Calculated channels created by this user.

TYPE: Any | str | None DEFAULT: None

modified_by

Calculated channels last modified by this user.

TYPE: Any | str | None DEFAULT: None

tags

Filter calculated channels with any of these Tags or tag names.

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

metadata

Filter calculated channels by metadata criteria.

TYPE: list[Any] | None DEFAULT: None

asset

Filter calculated channels associated with this Asset or asset ID.

TYPE: Asset | str | None DEFAULT: None

run

Filter calculated channels associated with this Run or run ID.

TYPE: Run | str | None DEFAULT: None

version

The version of the calculated channel.

TYPE: int | None DEFAULT: None

description_contains

Partial description of the calculated channel.

TYPE: str | None DEFAULT: None

include_archived

Include archived calculated channels.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter calculated channels.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved calculated channels.

TYPE: str | None DEFAULT: None

limit

How many calculated channels to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[CalculatedChannel]

A list of CalculatedChannels that matches the filter.

list_versions async

list_versions(
    *,
    calculated_channel: CalculatedChannel
    | str
    | None = None,
    client_key: str | None = None,
    name: str | None = None,
    names: list[str] | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | 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[CalculatedChannel]

List versions of a calculated channel.

PARAMETER DESCRIPTION
calculated_channel

The CalculatedChannel or ID of the calculated channel to get versions for.

TYPE: CalculatedChannel | str | None DEFAULT: None

client_key

The client key of the calculated channel.

TYPE: str | None DEFAULT: None

name

Exact name of the calculated channel.

TYPE: str | None DEFAULT: None

names

List of calculated channel names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Partial name of the calculated channel.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter calculated channels by name.

TYPE: str | Pattern | None DEFAULT: None

created_after

Filter versions created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter versions created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter versions modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter versions modified before this datetime.

TYPE: datetime | None DEFAULT: None

created_by

Filter versions created by this user or user ID.

TYPE: Any | str | None DEFAULT: None

modified_by

Filter versions modified by this user or user ID.

TYPE: Any | str | None DEFAULT: None

tags

Filter versions with any of these Tags or tag names.

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

metadata

Filter versions by metadata criteria.

TYPE: list[Any] | None DEFAULT: None

description_contains

Partial description of the calculated channel.

TYPE: str | None DEFAULT: None

include_archived

Include archived versions.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter versions.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved versions.

TYPE: str | None DEFAULT: None

limit

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

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[CalculatedChannel]

A list of CalculatedChannel versions that match the filter criteria.

unarchive async

unarchive(
    calculated_channel: str | CalculatedChannel,
) -> CalculatedChannel

Unarchive a calculated channel.

PARAMETER DESCRIPTION
calculated_channel

The id or CalculatedChannel object of the calculated channel to unarchive.

TYPE: str | CalculatedChannel

RETURNS DESCRIPTION
CalculatedChannel

The unarchived CalculatedChannel.

update async

update(
    calculated_channel: CalculatedChannel | str,
    update: CalculatedChannelUpdate | dict,
    *,
    user_notes: str | None = None,
) -> CalculatedChannel

Update a Calculated Channel.

PARAMETER DESCRIPTION
calculated_channel

The CalculatedChannel or id of the CalculatedChannel to update.

TYPE: CalculatedChannel | str

update

Updates to apply to the CalculatedChannel.

TYPE: CalculatedChannelUpdate | dict

user_notes

User notes for the update.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
CalculatedChannel

The updated CalculatedChannel.