Skip to content

sift_client.resources.exports

CLASS DESCRIPTION
DataExportAPIAsync

High-level API for exporting data from Sift.

DataExportAPIAsync

DataExportAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for exporting data from Sift.

Initialize the DataExportAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
export

Export data from Sift.

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

export async

export(
    *,
    output_format: ExportOutputFormat,
    runs: list[str | Run] | None = None,
    assets: list[str | Asset] | None = None,
    start_time: datetime | None = None,
    stop_time: datetime | None = None,
    channels: list[str | Channel] | None = None,
    calculated_channels: list[
        CalculatedChannel | CalculatedChannelCreate | dict
    ]
    | None = None,
    simplify_channel_names: bool = False,
    combine_runs: bool = False,
    split_export_by_asset: bool = False,
    split_export_by_run: bool = False,
) -> Job

Export data from Sift.

Initiates an export on the server and returns a Job handle. Use job.wait_and_download() to poll for completion and download the files.

There are three ways to scope the export, determined by which arguments are provided:

  1. By runs — provide runs. The start_time/stop_time are optional (if omitted, the full time range of each run is used). If no channels or calculated_channels are provided, all channels from the runs' assets are included.

  2. By assets — provide assets. Both start_time and stop_time are required. If no channels or calculated_channels are provided, all channels from the assets are included.

  3. By time range only — provide start_time and stop_time without runs or assets. At least one of channels or calculated_channels must be provided to scope the data.

You cannot provide both runs and assets at the same time.

PARAMETER DESCRIPTION
output_format

The file format for the export (CSV or Sun/WinPlot).

TYPE: ExportOutputFormat

runs

One or more Run objects or run IDs to export data from.

TYPE: list[str | Run] | None DEFAULT: None

assets

One or more Asset objects or asset IDs to export data from.

TYPE: list[str | Asset] | None DEFAULT: None

start_time

Start of the time range to export. Required when using assets or time-range-only mode; optional when using runs.

TYPE: datetime | None DEFAULT: None

stop_time

End of the time range to export. Required when using assets or time-range-only mode; optional when using runs.

TYPE: datetime | None DEFAULT: None

channels

Channel objects or channel IDs to include. If omitted and runs or assets are provided, all channels are exported. Required (along with calculated_channels) in time-range-only mode.

TYPE: list[str | Channel] | None DEFAULT: None

calculated_channels

Calculated channels to include in the export. Accepts existing CalculatedChannel objects, CalculatedChannelCreate definitions, or dictionaries that will be converted to CalculatedChannelCreate via model_validate.

TYPE: list[CalculatedChannel | CalculatedChannelCreate | dict] | None DEFAULT: None

simplify_channel_names

Remove text preceding last period in channel names, only if the resulting simplified name is unique.

TYPE: bool DEFAULT: False

combine_runs

Identical channels within the same asset across multiple runs will be combined into a single column.

TYPE: bool DEFAULT: False

split_export_by_asset

Split each asset into a separate file, with asset name removed from channel name display.

TYPE: bool DEFAULT: False

split_export_by_run

Split each run into a separate file, with run name removed from channel name display.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
Job

A Job handle for the pending export.