sift_client.sift_types
¶
Sift Types - Pydantic models for Sift resources.
This module provides strongly-typed Pydantic models for interacting with Sift resources. These models are used throughout the Sift client to provide type safety, validation, and convenient methods for working with Sift objects.
Resource BaseTypes¶
Resource BaseTypes are immutable Pydantic models that represent specific Sift objects retrieved from the API. They provide:
- Type-safe access to all resource properties
- Convenience methods for common operations (update, archive, etc.)
- Related resource access via properties (e.g.,
asset.runs,run.assets) - Rich integration with IDEs for autocomplete and type checking
Available Resource Types¶
Asset- Physical or logical entities (vehicles, machines, devices)Run- Time-bounded operational periods for an assetChannel- Time-series data streams (sensor readings, telemetry)- etc.
Create and Update Types¶
Create and Update types are Pydantic models used to create new resources or modify existing ones. They can be used directly as typed objects or as dictionaries for convenience.
Create Types¶
Create types define the required and optional fields for creating new resources. For example:
RunCreate- Create a new runCalculatedChannelCreate- Create a new calculated channelRuleCreate- Create a new rule- etc.
Update Types¶
Update types define which fields can be modified on existing resources. For example:
AssetUpdate- Update asset propertiesRunUpdate- Update run propertiesCalculatedChannelUpdate- Update calculated channel properties- etc.
Example Usage¶
from sift_client import SiftClient
from sift_client.sift_types import RunCreate, AssetUpdate
client = SiftClient(api_key="...", grpc_url="...", rest_url="...")
# Using Create types - typed approach
run = client.runs.create(
RunCreate(
name="Test Run",
description="A test run",
asset_ids=["asset123"],
start_time=datetime.now(),
)
)
# Using Create types - dict approach (more convenient)
run = client.runs.create({
"name": "Test Run",
"description": "A test run",
"asset_ids": ["asset123"],
"start_time": datetime.now(),
})
# Using Update types - typed approach
asset = client.assets.update(
asset="asset123",
update=AssetUpdate(tags=["production", "v2"])
)
# Using Update types - dict approach (more convenient)
asset = client.assets.update(
asset="asset123",
update={"tags": ["production", "v2"]}
)
# Using convenience methods on resource instances
asset.update({"tags": ["production", "v3"]})
Helper Types¶
Additional types are provided for specific use cases. For example:
ChannelReference- Reference to a channel in expressionsChannelDataType- Enum for channel data typesChannelBitFieldElement- Bit field element definitionRuleActionType- Enum for rule action typesRuleAnnotationType- Enum for annotation typesChannelConfig- Configuration for data ingestion channelsFlow- Data flow configuration for ingestionIngestionConfig- Complete ingestion configuration- etc.
Type Validation¶
All types use Pydantic for validation, ensuring:
- Required fields are present
- Field types are correct
- Datetime fields have timezone information
- Enum values are valid
Validation errors are raised immediately with clear error messages.
Immutability¶
Resource BaseTypes (Asset, Run, etc.) are immutable by default. To update a resource,
use the update() method, which will update the instance in-place by replacing its
internal state with the updated values from the API.
asset = client.assets.get(asset_id="asset123")
# This will raise an error - assets are immutable
# asset.name = "New Name"
# Instead, use the update method
asset.update({"tags": ["new-tag"]}) # Updates the instance in-place
| MODULE | DESCRIPTION |
|---|---|
asset |
|
calculated_channel |
|
channel |
|
data_import |
|
export |
|
file_attachment |
|
ingestion |
|
job |
Job types for the Sift API. |
principal_attribute |
Domain types for principal attributes (ABAC). |
report |
|
report_template |
|
resource_attribute |
Domain types for resource attributes (ABAC). |
rule |
|
run |
|
tag |
|
test_report |
|
| CLASS | DESCRIPTION |
|---|---|
Asset |
Model of the Sift Asset. |
AssetUpdate |
Model of the Asset Fields that can be updated. |
CalculatedChannel |
Model of the Sift Calculated Channel. |
CalculatedChannelCreate |
Create model for a Calculated Channel. |
CalculatedChannelUpdate |
Update model for a Calculated Channel. |
Channel |
Model representing a Sift Channel. |
ChannelBitFieldElement |
Bit field element model. |
ChannelDataType |
Enum for channel data types (mimics protobuf values, but as int for now). |
ChannelReference |
Channel reference for a calculated channel or rule expression. |
ChannelUpdate |
Model of the Channel fields that can be updated. |
ChannelConfig |
Channel configuration model for ingestion purposes. |
Flow |
Model representing a data flow for ingestion. |
FlowConfig |
Model representing a data flow config for ingestion. |
IngestionConfig |
Model of the Sift Ingestion Config. |
IngestionConfigCreate |
Create model for IngestionConfig. |
DataExportDetails |
Details for a data export job. |
DataExportStatusDetails |
Status details for a data export job. |
DataImportDetails |
Details for a data import job. |
DataImportStatusDetails |
Status details for a data import job. |
Job |
A job in the Sift system. |
JobStatus |
Status of a job. |
JobType |
Type of job. |
RuleEvaluationDetails |
Details for a rule evaluation job. |
RuleEvaluationStatusDetails |
Status details for a rule evaluation job. |
PrincipalAttributeEnumValue |
An allowed value for an |
PrincipalAttributeKey |
A principal attribute key. Enum values and assignments are managed through it. |
PrincipalAttributeValue |
A single assignment of a principal attribute value to a principal. |
PrincipalAttributeValueType |
Value type of a principal attribute key. |
PrincipalType |
Kind of principal a principal attribute can be assigned to. |
Report |
Report model representing a data analysis report. |
ReportRuleStatus |
Report rule status. |
ReportRuleSummary |
ReportRuleSummary model representing a rule summary within a report. |
ReportUpdate |
Model of the Report fields that can be updated. |
ReportTemplate |
ReportTemplate model representing a reusable set of rules for creating reports. |
ReportTemplateCreate |
Model for creating a new ReportTemplate. |
ReportTemplateRule |
ReportTemplateRule model representing a rule attached to a report template. |
ReportTemplateUpdate |
Model of the ReportTemplate fields that can be updated. |
ResourceAttribute |
A single assignment of a resource attribute value to an entity. |
ResourceAttributeEntity |
Identifies the entity a resource attribute is assigned to. |
ResourceAttributeEntityType |
Kind of Sift entity a resource attribute can be assigned to. |
ResourceAttributeEnumValue |
An allowed value for an |
ResourceAttributeKey |
A resource attribute key. Enum values and assignments are managed through it. |
ResourceAttributeKeyType |
Value type of a resource attribute key. |
Rule |
Model of the Sift Rule. |
RuleAction |
Model of a Rule Action. |
RuleActionType |
Enum for rule action kinds. |
RuleAnnotationType |
Enum for rule annotation types. |
RuleCreate |
Model for creating a new Rule. |
RuleUpdate |
Model of the Rule fields that can be updated. |
RuleVersion |
Model of a Rule Version. |
Run |
Run model representing a data collection run. |
RunCreate |
Create model for Run. |
RunUpdate |
Update model for Run. |
Tag |
Model of the Sift Tag. |
TagCreate |
Create model for Tag. |
TagUpdate |
Update model for Tag. |
TestMeasurement |
TestMeasurement model representing a measurement in a test. |
TestMeasurementCreate |
Create model for TestMeasurement. |
TestMeasurementType |
TestMeasurementType enum. |
TestReport |
TestReport model representing a test report. |
TestReportCreate |
Create model for TestReport. |
TestReportUpdate |
Update model for TestReport. |
TestStatus |
TestStatus enum. |
TestStep |
TestStep model representing a step in a test. |
TestStepCreate |
Create model for TestStep. |
TestStepType |
TestStepType enum. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
JobDetails |
|
JobStatusDetails |
|
JobDetails
module-attribute
¶
JobDetails = Union[
DataImportDetails,
DataExportDetails,
RuleEvaluationDetails,
]
JobStatusDetails
module-attribute
¶
JobStatusDetails = Union[
DataImportStatusDetails,
DataExportStatusDetails,
RuleEvaluationStatusDetails,
]
Asset
pydantic-model
¶
Bases: BaseType[Asset, 'Asset'], FileAttachmentsMixin
Model of the Sift Asset.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
organization_id(str) -
created_date(datetime) -
created_by_user_id(str) -
modified_date(datetime) -
modified_by_user_id(str) -
tags(list[str | Tag]) -
metadata(dict[str, str | float | bool]) -
is_archived(bool) -
archived_date(datetime | None)
Validators:
-
_validate_timezones
attachments
property
¶
attachments: list[FileAttachment]
Get all file attachments for this entity.
| RETURNS | DESCRIPTION |
|---|---|
list[FileAttachment]
|
A list of FileAttachments associated with this entity. |
check_is_supported_entity_type
staticmethod
¶
Check if the entity type is supported for file attachments.
| RETURNS | DESCRIPTION |
|---|---|
|
True if the entity type is supported, False otherwise. |
delete_attachment
¶
delete_attachment(
file_attachment: list[FileAttachment | str]
| FileAttachment
| str,
) -> None
Delete one or more file attachments.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
A single FileAttachment or list of FileAttachments to delete.
TYPE:
|
upload_attachment
¶
upload_attachment(
path: str | Path,
metadata: dict[str, Any] | None = None,
description: str | None = None,
organization_id: str | None = None,
) -> FileAttachment
Upload a file attachment to a remote file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to upload.
TYPE:
|
metadata
|
Optional metadata for the file (e.g., video/image metadata).
TYPE:
|
description
|
Optional description of the file.
TYPE:
|
organization_id
|
Optional organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The uploaded FileAttachment. |
channels
¶
Get the channels for this asset.
archive
¶
archive(*, archive_runs: bool = False) -> Asset
Archive the asset.
| PARAMETER | DESCRIPTION |
|---|---|
archive_runs
|
If True, archive all Runs associated with the Asset.
TYPE:
|
update
¶
update(update: AssetUpdate | dict) -> Asset
Update the Asset.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
Either an AssetUpdate instance or a dictionary of key-value pairs to update.
TYPE:
|
AssetUpdate
pydantic-model
¶
Bases: ModelUpdate[Asset]
Model of the Asset Fields that can be updated.
Fields:
-
_field_helpers_called(set[str]) -
tags(list[str | Tag] | None) -
metadata(dict[str, str | float | bool] | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
CalculatedChannel
pydantic-model
¶
Bases: BaseType[CalculatedChannel, 'CalculatedChannel']
Model of the Sift Calculated Channel.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
description(str) -
expression(str) -
channel_references(list[ChannelReference]) -
is_archived(bool) -
units(str | None) -
asset_ids(list[str] | None) -
tag_ids(list[str] | None) -
all_assets(bool | None) -
organization_id(str | None) -
client_key(str | None) -
archived_date(datetime | None) -
version_id(str | None) -
version(int | None) -
change_message(str | None) -
user_notes(str | None) -
created_date(datetime | None) -
modified_date(datetime | None) -
created_by_user_id(str | None) -
modified_by_user_id(str | None)
Validators:
-
_validate_timezones
update
¶
update(
update: CalculatedChannelUpdate | dict,
user_notes: str | None = None,
) -> CalculatedChannel
Update the Calculated Channel.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
The update to apply to the calculated channel. See CalculatedChannelUpdate for more updatable fields.
TYPE:
|
user_notes
|
The user notes to apply to the calculated channel.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CalculatedChannel
|
The updated calculated channel. |
CalculatedChannelCreate
pydantic-model
¶
Bases: CalculatedChannelBase, ModelCreate[CreateCalculatedChannelRequest]
Create model for a Calculated Channel.
Fields:
-
_field_helpers_called(set[str]) -
description(str | None) -
units(str | None) -
expression(str | None) -
expression_channel_references(list[ChannelReference] | None) -
tag_ids(list[str] | None) -
asset_ids(list[str] | None) -
all_assets(bool | None) -
metadata(dict[str, str | float | bool] | None) -
name(str) -
user_notes(str | None) -
client_key(str | None)
Validators:
-
_check_mapping_helpers -
_validate_asset_configuration -
_validate_expression_and_channel_references
expression_channel_references
pydantic-field
¶
expression_channel_references: (
list[ChannelReference] | None
) = None
CalculatedChannelUpdate
pydantic-model
¶
Bases: CalculatedChannelBase, ModelUpdate[CalculatedChannel]
Update model for a Calculated Channel.
Fields:
-
_field_helpers_called(set[str]) -
description(str | None) -
units(str | None) -
expression(str | None) -
expression_channel_references(list[ChannelReference] | None) -
tag_ids(list[str] | None) -
asset_ids(list[str] | None) -
all_assets(bool | None) -
metadata(dict[str, str | float | bool] | None) -
name(str | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers -
_validate_asset_configuration -
_validate_expression_and_channel_references
expression_channel_references
pydantic-field
¶
expression_channel_references: (
list[ChannelReference] | None
) = None
to_proto_with_mask
¶
Convert to proto with field mask.
Channel
pydantic-model
¶
Bases: BaseType[Channel, 'Channel']
Model representing a Sift Channel.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
data_type(ChannelDataType) -
description(str) -
unit(str) -
bit_field_elements(list[ChannelBitFieldElement]) -
enum_types(dict[str, int]) -
asset_id(str) -
metadata(dict[str, str | float | bool]) -
is_archived(bool) -
created_date(datetime) -
modified_date(datetime) -
created_by_user_id(str) -
modified_by_user_id(str)
Validators:
-
_validate_timezones
data
¶
data(
*,
run_id: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
limit: int | None = None,
as_arrow: bool = False,
)
Retrieve channel data for this channel during the specified run.
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
The run ID to get data for.
TYPE:
|
start_time
|
The start time to get data for.
TYPE:
|
end_time
|
The end time to get data for.
TYPE:
|
limit
|
The maximum number of data points to return.
TYPE:
|
as_arrow
|
Whether to return the data as an Arrow table.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
|
A dict of channel name to pandas DataFrame or Arrow Table object. |
update
¶
update(update: ChannelUpdate | dict) -> Channel
Update the Channel.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
Either a ChannelUpdate instance or a dictionary of fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Channel
|
The updated Channel. |
ChannelBitFieldElement
pydantic-model
¶
ChannelDataType
¶
Bases: Enum
Enum for channel data types (mimics protobuf values, but as int for now).
| METHOD | DESCRIPTION |
|---|---|
from_api_format |
Convert API format string to ChannelDataType. |
from_str |
Convert string representation to ChannelDataType. |
proto_data_class |
Return the appropriate protobuf class for the given channel data type. |
hash_str |
Get the hash string for this channel data type. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
DOUBLE |
|
STRING |
|
ENUM |
|
BIT_FIELD |
|
BOOL |
|
FLOAT |
|
INT_32 |
|
INT_64 |
|
UINT_32 |
|
UINT_64 |
|
BYTES |
|
from_api_format
staticmethod
¶
from_api_format(val: str) -> ChannelDataType | None
Convert API format string to ChannelDataType.
| PARAMETER | DESCRIPTION |
|---|---|
val
|
API format string representation of ChannelDataType.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelDataType | None
|
ChannelDataType if conversion is successful, None otherwise. |
from_str
staticmethod
¶
from_str(raw: str) -> ChannelDataType | None
Convert string representation to ChannelDataType.
| PARAMETER | DESCRIPTION |
|---|---|
raw
|
String representation of ChannelDataType.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelDataType | None
|
ChannelDataType if conversion is successful, None otherwise. |
| RAISES | DESCRIPTION |
|---|---|
Exception
|
If the string format is recognized but cannot be converted. |
proto_data_class
staticmethod
¶
proto_data_class(data_type: ChannelDataType)
Return the appropriate protobuf class for the given channel data type.
| PARAMETER | DESCRIPTION |
|---|---|
data_type
|
The channel data type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
|
The protobuf class corresponding to the data type. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the data type is not recognized. |
hash_str
¶
Get the hash string for this channel data type.
ChannelReference
pydantic-model
¶
Bases: BaseModel
Channel reference for a calculated channel or rule expression.
Exactly one of channel_identifier or calculated_channel must be set.
To reference another calculated channel (nested CC), pass either a fetched
CalculatedChannel (its version_id is used) or a version_id string
directly. Both normalize to the version_id string after validation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
channel_reference |
The key of the channel in the expression (e.g.
TYPE:
|
channel_identifier |
The name (or ID) of an existing channel.
TYPE:
|
calculated_channel |
A
TYPE:
|
Fields:
-
channel_reference(str) -
channel_identifier(str | None) -
calculated_channel(CalculatedChannel | str | None)
Validators:
-
_normalize_and_validate
ChannelUpdate
pydantic-model
¶
Bases: ModelUpdate[Channel]
Model of the Channel fields that can be updated.
A channel's canonical description and unit are set at creation and are immutable
afterward. Updating description or unit writes the channel's display
override (display_description / display_unit_id), which is the value the
Sift app shows in place of the canonical one.
Fields:
-
_field_helpers_called(set[str]) -
description(str | None) -
unit(str | None) -
metadata(dict[str, str | float | bool] | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
ChannelConfig
pydantic-model
¶
Bases: BaseType[ChannelConfig, 'ChannelConfig']
Channel configuration model for ingestion purposes.
This model contains only the fields needed for ingestion configuration, without the full metadata from the Channels API.
Config:
frozen:False
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
data_type(ChannelDataType) -
description(str | None) -
unit(str | None) -
bit_field_elements(list[ChannelBitFieldElement] | None) -
enum_types(dict[str, int] | None)
Validators:
-
_validate_timezones -
_validate_enum_types
bit_field_elements
pydantic-field
¶
bit_field_elements: list[ChannelBitFieldElement] | None = (
None
)
from_channel
classmethod
¶
from_channel(channel: Channel) -> ChannelConfig
Create ChannelConfig from a Channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The Channel to convert.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelConfig
|
A ChannelConfig with the channel's configuration data. |
as_channel_value
¶
as_channel_value(value: Any) -> ChannelValue
Create a ChannelValue from a value using this channel's configuration.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value to wrap in a ChannelValue. The type should match this channel's data_type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelValue
|
A ChannelValue instance with this channel's name and data type, |
ChannelValue
|
containing the provided value. |
Flow
pydantic-model
¶
Bases: BaseModel
Model representing a data flow for ingestion.
A Flow represents a collection of channels that are ingested together.
A representation of the IngestWithConfigDataStreamRequest proto
Config:
frozen:False
Fields:
-
ingestion_config_id(str | None) -
flow(str) -
timestamp(datetime) -
channel_values(list[ChannelValue]) -
run_id(str | None) -
end_stream_on_validation_error(bool | None) -
organization_id(str | None)
FlowConfig
pydantic-model
¶
Bases: BaseType[FlowConfig, 'FlowConfig']
Model representing a data flow config for ingestion.
A FlowConfig represents the configuration of a collection of channels that are ingested together.
Config:
frozen:False
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
channels(list[ChannelConfig]) -
ingestion_config_id(str | None) -
run_id(str | None)
Validators:
-
_validate_timezones
add_channel
¶
add_channel(channel: ChannelConfig)
Add a ChannelConfig to this Flow.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The ChannelConfig to add.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the flow has already been created with an ingestion config. |
as_flow
¶
as_flow(
*,
timestamp: datetime | None = None,
values: dict[str, Any],
) -> Flow
Create a Flow from this FlowConfig with the provided values.
| PARAMETER | DESCRIPTION |
|---|---|
timestamp
|
The timestamp for the flow. If None, uses the current UTC time.
TYPE:
|
values
|
A dictionary mapping channel names to their values. Only channels present in this dictionary will be included in the resulting Flow.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Flow
|
A Flow object with channel values created from the provided values dictionary. |
IngestionConfig
pydantic-model
¶
Bases: BaseType[IngestionConfig, 'IngestionConfig']
Model of the Sift Ingestion Config.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
asset_id(str) -
client_key(str)
Validators:
-
_validate_timezones
IngestionConfigCreate
pydantic-model
¶
Bases: ModelCreate[CreateIngestionConfigRequest]
Create model for IngestionConfig.
Fields:
-
_field_helpers_called(set[str]) -
asset_name(str) -
flows(list[FlowConfig] | None) -
organization_id(str | None) -
client_key(str | None)
Validators:
-
_check_mapping_helpers
DataExportDetails
pydantic-model
¶
DataExportStatusDetails
pydantic-model
¶
DataImportDetails
pydantic-model
¶
DataImportStatusDetails
pydantic-model
¶
Bases: BaseModel
Status details for a data import job.
Fields:
-
points_processed(int) -
points_total(int)
Job
pydantic-model
¶
Bases: BaseType[Job, 'Job']
A job in the Sift system.
Jobs represent long-running operations like data imports, rule evaluations, and data exports.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
created_by_user_id(str) -
modified_by_user_id(str) -
created_date(datetime) -
modified_date(datetime) -
job_type(JobType) -
job_status(JobStatus) -
started_date(datetime | None) -
completed_date(datetime | None) -
job_status_details(JobStatusDetails | None) -
job_details(JobDetails | None)
Validators:
-
_validate_timezones
is_in_progress
property
¶
Return True if the job is in progress, False otherwise.
A job is in progress if its status is RUNNING.
is_failed
property
¶
Return True if the job has failed, False otherwise.
A job has failed if its status is FAILED.
is_finished
property
¶
Return True if the job has finished, False otherwise.
A job has finished if its status is FINISHED.
is_cancelled
property
¶
Return True if the job has been cancelled, False otherwise.
A job has been cancelled if its status is CANCELLED.
refresh
¶
refresh() -> Job
Refresh this job with the latest data from the API.
| RETURNS | DESCRIPTION |
|---|---|
Job
|
The updated Job object. |
cancel
¶
Cancel this job.
If the job hasn't started yet, it will be cancelled immediately. Jobs that are already finished, failed, or cancelled are not affected.
retry
¶
retry() -> Job
Retry this job.
Jobs that are finished, in progress, or in the process of being cancelled are not affected.
| RETURNS | DESCRIPTION |
|---|---|
Job
|
The updated Job object. |
wait_until_complete
¶
wait_until_complete(
*,
polling_interval_secs: int = 5,
timeout_secs: int | None = None,
) -> Job
Wait until the job is complete or the timeout is reached.
Polls the job status at the given interval until the job is FINISHED, FAILED, or CANCELLED, returning the completed Job
| PARAMETER | DESCRIPTION |
|---|---|
job
|
The Job or job_id to wait for.
|
polling_interval_secs
|
Seconds between status polls. Defaults to 5s.
TYPE:
|
timeout_secs
|
Maximum seconds to wait. If None, polls indefinitely. Defaults to None (indefinite).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job
|
The Job in the completed state. |
get_import_run
¶
get_import_run() -> Run
Get the run created by this data import job.
| RETURNS | DESCRIPTION |
|---|---|
Run
|
The Run associated with this import. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If this is not a data import job or the import has no associated run. |
wait_and_download
¶
wait_and_download(
*,
polling_interval_secs: int = 5,
timeout_secs: int | None = None,
output_dir: str | Path | None = None,
extract: bool = True,
) -> list[Path]
Wait for a job to complete and download the result files.
Polls the job status at the given interval until the job is FINISHED, FAILED, or CANCELLED, then downloads the result files.
| PARAMETER | DESCRIPTION |
|---|---|
polling_interval_secs
|
Seconds between status polls. Defaults to 5.
TYPE:
|
timeout_secs
|
Maximum seconds to wait. If None, polls indefinitely.
TYPE:
|
output_dir
|
Directory to save the downloaded files. If omitted, a temporary directory is created automatically.
TYPE:
|
extract
|
If True (default) and the downloaded file is a zip, extract it and delete the archive, returning paths to the extracted files. Non-zip files are returned as-is regardless of this flag.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Path]
|
List of paths to the downloaded/extracted files. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the job fails or is cancelled. |
TimeoutError
|
If the job does not complete within timeout_secs. |
JobStatus
¶
Bases: str, Enum
Status of a job.
| METHOD | DESCRIPTION |
|---|---|
to_filter_str |
Convert to string representation. |
from_proto |
Create from proto enum value. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
CREATED |
|
RUNNING |
|
FINISHED |
|
FAILED |
|
CANCELLED |
|
CANCEL_REQUESTED |
|
JobType
¶
Bases: str, Enum
Type of job.
| METHOD | DESCRIPTION |
|---|---|
to_filter_str |
Convert to string representation. |
to_proto |
Convert to proto enum value. |
from_proto |
Create from proto enum value. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
RULE_EVALUATION |
|
DATA_IMPORT |
|
DATA_EXPORT |
|
RuleEvaluationDetails
pydantic-model
¶
RuleEvaluationStatusDetails
pydantic-model
¶
Bases: BaseModel
Status details for a rule evaluation job.
PrincipalAttributeEnumValue
pydantic-model
¶
Bases: BaseType[PrincipalAttributeEnumValue, 'PrincipalAttributeEnumValue']
An allowed value for an ENUM or SET_OF_ENUM principal attribute key.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
key_id(str) -
display_name(str) -
description(str) -
created_date(datetime) -
created_by_user_id(str) -
modified_date(datetime) -
modified_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
archive
¶
archive(
*,
replacement: PrincipalAttributeEnumValue
| str
| None = None,
) -> int
Archive this enum value, migrating existing assignments to a replacement.
| PARAMETER | DESCRIPTION |
|---|---|
replacement
|
Enum value (or ID) that existing assignments should be reassigned to. If None, assignments using this value are archived.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The number of principal attribute values that were migrated. |
Note
Returns the migration count; it does not refresh this instance's
is_archived/archived_date. Re-fetch the enum value to observe those.
PrincipalAttributeKey
pydantic-model
¶
Bases: BaseType[PrincipalAttributeKey, 'PrincipalAttributeKey']
A principal attribute key. Enum values and assignments are managed through it.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
display_name(str) -
description(str) -
value_type(PrincipalAttributeValueType) -
created_date(datetime) -
created_by_user_id(str) -
modified_date(datetime) -
modified_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
create_enum_value
¶
create_enum_value(
display_name: str, *, description: str = ""
) -> PrincipalAttributeEnumValue
Create a single enum value for this key.
get_or_create_enum_values
¶
get_or_create_enum_values(
names: list[str],
) -> list[PrincipalAttributeEnumValue]
Get existing enum values by name, creating any that don't exist.
list_enum_values
¶
list_enum_values(
*, include_archived: bool = False
) -> list[PrincipalAttributeEnumValue]
List the enum values defined for this key.
assign_to
¶
assign_to(
principals,
*,
value,
principal_type: PrincipalType = USER,
) -> list[PrincipalAttributeValue]
Assign a value to one or more principals for this key.
| PARAMETER | DESCRIPTION |
|---|---|
principals
|
Principal IDs to assign to. For
|
value
|
The value to assign. For
|
principal_type
|
The kind of principal being assigned to. Defaults to
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[PrincipalAttributeValue]
|
The created assignments. |
list_assignments
¶
list_assignments(
*,
principal_type: PrincipalType = USER,
include_archived: bool = False,
) -> list[PrincipalAttributeValue]
List all assignments of this key for the given principal type.
update
¶
update(
*,
display_name: str | None = None,
description: str | None = None,
) -> PrincipalAttributeKey
Update this key's display name or description.
archive
¶
archive() -> PrincipalAttributeKey
Archive this key. Cascades to its enum values and assignments.
check_archive_impact
¶
Return the number of active assignments that archiving this key would affect.
PrincipalAttributeValue
pydantic-model
¶
Bases: BaseType[PrincipalAttributeValue, 'PrincipalAttributeValue']
A single assignment of a principal attribute value to a principal.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
key_id(str) -
principal_id(str) -
principal_type(PrincipalType) -
enum_value_id(str | None) -
boolean_value(bool | None) -
number_value(int | None) -
key(PrincipalAttributeKey | None) -
enum_value(PrincipalAttributeEnumValue | None) -
created_date(datetime | None) -
created_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
PrincipalAttributeValueType
¶
Bases: Enum
Value type of a principal attribute key.
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
ENUM |
|
BOOLEAN |
|
NUMBER |
|
SET_OF_ENUM |
|
PrincipalType
¶
Bases: Enum
Kind of principal a principal attribute can be assigned to.
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
USER |
|
USER_GROUP |
|
Report
pydantic-model
¶
Bases: BaseType[Report, 'Report']
Report model representing a data analysis report.
Config:
arbitrary_types_allowed:True
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
report_template_id(str) -
run_id(str) -
organization_id(str) -
name(str) -
description(str) -
created_by_user_id(str) -
modified_by_user_id(str) -
created_date(datetime) -
modified_date(datetime) -
summaries(list[ReportRuleSummary]) -
tags(list[str]) -
rerun_from_report_id(str | None) -
metadata(dict[str, str | float | bool]) -
job_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
model_config
class-attribute
instance-attribute
¶
ReportRuleStatus
¶
ReportRuleSummary
pydantic-model
¶
Bases: BaseType[ReportRuleSummary, 'ReportRuleSummary']
ReportRuleSummary model representing a rule summary within a report.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
rule_id(str) -
rule_client_key(str | None) -
rule_version_id(str) -
rule_version_number(int) -
report_rule_version_id(str) -
num_open(int) -
num_failed(int) -
num_passed(int) -
status(ReportRuleStatus) -
created_date(datetime) -
modified_date(datetime) -
asset_id(str) -
deleted_date(datetime | None)
Validators:
-
_validate_timezones
ReportUpdate
pydantic-model
¶
Bases: ModelUpdate[Report]
Model of the Report fields that can be updated.
Fields:
-
_field_helpers_called(set[str]) -
is_archived(bool | None) -
metadata(dict[str, str | float | bool] | None) -
tags(list[str | Tag] | None)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
ReportTemplate
pydantic-model
¶
Bases: BaseType[ReportTemplate, 'ReportTemplate']
ReportTemplate model representing a reusable set of rules for creating reports.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
client_key(str | None) -
name(str) -
description(str | None) -
created_by_user_id(str) -
modified_by_user_id(str) -
created_date(datetime) -
modified_date(datetime) -
rules(list[ReportTemplateRule]) -
tags(list[str]) -
metadata(dict[str, str | float | bool]) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
update
¶
update(
update: ReportTemplateUpdate | dict,
) -> ReportTemplate
Update the ReportTemplate.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
Either a ReportTemplateUpdate instance or a dictionary of key-value pairs to update.
TYPE:
|
create_report
¶
create_report(
*,
run: Run | str,
name: str | None = None,
organization_id: str | None = None,
) -> Job | None
Create a report from this template.
| PARAMETER | DESCRIPTION |
|---|---|
run
|
The Run or run ID to associate with the report.
TYPE:
|
name
|
Optional name for the report.
TYPE:
|
organization_id
|
The organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending report, or None if no report was created. |
ReportTemplateCreate
pydantic-model
¶
Bases: ReportTemplateCreateUpdateBase, ModelCreate[CreateReportTemplateRequest]
Model for creating a new ReportTemplate.
Note
- Rules can be attached with either rule_ids or rule_client_keys, but not both.
- The order of rule_ids determines each rule's display order on the template.
Fields:
-
_field_helpers_called(set[str]) -
rule_ids(list[str | Rule] | None) -
rule_client_keys(list[str] | None) -
name(str) -
client_key(str | None) -
description(str | None) -
tags(list[str | Tag] | None) -
metadata(dict[str, str | float | bool] | None) -
organization_id(str | None)
Validators:
-
_check_mapping_helpers -
_validate_rule_identifiers
ReportTemplateRule
pydantic-model
¶
Bases: BaseType[ReportTemplateRule, 'ReportTemplateRule']
ReportTemplateRule model representing a rule attached to a report template.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
rule_id(str) -
rule_version_id(str) -
rule_version_number(int) -
rule_client_key(str | None) -
display_order(int)
Validators:
-
_validate_timezones
ReportTemplateUpdate
pydantic-model
¶
Bases: ReportTemplateCreateUpdateBase, ModelUpdate[ReportTemplate]
Model of the ReportTemplate fields that can be updated.
Note
- Updating tags, rule_ids, or rule_client_keys replaces the full list on the template. Pass an empty list to clear tags. Rules cannot be cleared; a report template must always have at least one rule.
- Only one of rule_ids or rule_client_keys may be provided.
Fields:
-
_field_helpers_called(set[str]) -
name(str | None) -
description(str | None) -
is_archived(bool | None) -
metadata(dict[str, str | float | bool] | None) -
tags(list[str | Tag] | None) -
rule_ids(list[str | Rule] | None) -
rule_client_keys(list[str] | None)
Validators:
-
_check_mapping_helpers -
_validate_rule_identifiers -
_validate_rules_not_cleared
to_proto_with_mask
¶
Convert to proto with field mask, including the repeated message fields.
ResourceAttribute
pydantic-model
¶
Bases: BaseType[ResourceAttribute, 'ResourceAttribute']
A single assignment of a resource attribute value to an entity.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
key_id(str) -
entity(ResourceAttributeEntity | None) -
enum_value_id(str | None) -
boolean_value(bool | None) -
number_value(int | None) -
key(ResourceAttributeKey | None) -
enum_value(ResourceAttributeEnumValue | None) -
created_date(datetime | None) -
created_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
ResourceAttributeEntity
pydantic-model
¶
Bases: BaseModel
Identifies the entity a resource attribute is assigned to.
Fields:
for_asset
classmethod
¶
for_asset(entity_id: str) -> ResourceAttributeEntity
Build an entity identifier for an asset ID.
for_channel
classmethod
¶
for_channel(entity_id: str) -> ResourceAttributeEntity
Build an entity identifier for a channel ID.
for_run
classmethod
¶
for_run(entity_id: str) -> ResourceAttributeEntity
Build an entity identifier for a run ID.
ResourceAttributeEntityType
¶
Bases: Enum
Kind of Sift entity a resource attribute can be assigned to.
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
ASSET |
|
CHANNEL |
|
RUN |
|
UNSPECIFIED
class-attribute
instance-attribute
¶
ResourceAttributeEnumValue
pydantic-model
¶
Bases: BaseType[ResourceAttributeEnumValue, 'ResourceAttributeEnumValue']
An allowed value for an ENUM or SET_OF_ENUM resource attribute key.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
key_id(str) -
display_name(str) -
description(str) -
created_date(datetime) -
created_by_user_id(str) -
modified_date(datetime) -
modified_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
archive
¶
archive(
*,
replacement: ResourceAttributeEnumValue
| str
| None = None,
) -> int
Archive this enum value, migrating existing assignments to a replacement.
| PARAMETER | DESCRIPTION |
|---|---|
replacement
|
Enum value (or ID) that existing assignments should be reassigned to. If None, assignments using this value are archived.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The number of resource attribute assignments that were migrated. |
Note
Returns the migration count; it does not refresh this instance's
is_archived/archived_date. Re-fetch the enum value to observe those.
ResourceAttributeKey
pydantic-model
¶
Bases: BaseType[ResourceAttributeKey, 'ResourceAttributeKey']
A resource attribute key. Enum values and assignments are managed through it.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
organization_id(str) -
display_name(str) -
description(str) -
key_type(ResourceAttributeKeyType) -
created_date(datetime) -
created_by_user_id(str) -
modified_date(datetime) -
modified_by_user_id(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
create_enum_value
¶
create_enum_value(
display_name: str, *, description: str = ""
) -> ResourceAttributeEnumValue
Create a single enum value for this key.
get_or_create_enum_values
¶
get_or_create_enum_values(
names: list[str],
) -> list[ResourceAttributeEnumValue]
Get existing enum values by name, creating any that don't exist.
list_enum_values
¶
list_enum_values(
*, include_archived: bool = False
) -> list[ResourceAttributeEnumValue]
List the enum values defined for this key.
assign_to
¶
assign_to(entities, *, value) -> list[ResourceAttribute]
Assign a value to one or more entities for this key.
| PARAMETER | DESCRIPTION |
|---|---|
entities
|
Entities to assign to. Each may be a
|
value
|
The value to assign. For
|
| RETURNS | DESCRIPTION |
|---|---|
list[ResourceAttribute]
|
The created assignments. |
list_assignments
¶
list_assignments(
*, include_archived: bool = False
) -> list[ResourceAttribute]
List all assignments of this key.
update
¶
update(
*,
display_name: str | None = None,
description: str | None = None,
) -> ResourceAttributeKey
Update this key's display name or description.
archive
¶
archive() -> ResourceAttributeKey
Archive this key. Cascades to its enum values and assignments.
check_archive_impact
¶
Return the number of active assignments that archiving this key would affect.
ResourceAttributeKeyType
¶
Bases: Enum
Value type of a resource attribute key.
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
ENUM |
|
BOOLEAN |
|
NUMBER |
|
SET_OF_ENUM |
|
Rule
pydantic-model
¶
Bases: BaseType[Rule, 'Rule']
Model of the Sift Rule.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
description(str) -
created_date(datetime) -
modified_date(datetime) -
created_by_user_id(str) -
modified_by_user_id(str) -
organization_id(str) -
is_archived(bool) -
is_external(bool) -
evaluate_on_live_data(bool) -
current_version_id(str) -
expression(str | None) -
channel_references(list[ChannelReference] | None) -
action(RuleAction | None) -
asset_ids(list[str] | None) -
asset_tag_ids(list[str] | None) -
contextual_channels(list[str] | None) -
client_key(str | None) -
rule_version(RuleVersion | None) -
archived_date(datetime | None)
Validators:
-
_validate_timezones
update
¶
update(
update: RuleUpdate | dict,
version_notes: str | None = None,
) -> Rule
Update the Rule.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
Either a RuleUpdate instance or a dictionary of key-value pairs to update.
TYPE:
|
version_notes
|
Notes associated with the change.
TYPE:
|
RuleAction
pydantic-model
¶
Bases: BaseType[RuleAction, 'RuleAction']
Model of a Rule Action.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
action_type(RuleActionType) -
condition_id(str | None) -
created_date(datetime | None) -
modified_date(datetime | None) -
created_by_user_id(str | None) -
modified_by_user_id(str | None) -
version_id(str | None) -
annotation_type(RuleAnnotationType | None) -
tags_ids(list[str] | None) -
default_assignee_user(str | None)
Validators:
-
_validate_timezones
annotation
classmethod
¶
annotation(
annotation_type: RuleAnnotationType,
tags: list[str | Tag],
default_assignee_user: str | None = None,
) -> RuleAction
Create an annotation action.
| PARAMETER | DESCRIPTION |
|---|---|
annotation_type
|
Type of annotation to create.
TYPE:
|
default_assignee_user
|
User ID to assign the annotation to.
TYPE:
|
tags
|
List of tags or tag IDs to add to the annotation.
TYPE:
|
RuleActionType
¶
Bases: Enum
Enum for rule action kinds.
| METHOD | DESCRIPTION |
|---|---|
from_str |
Convert string representation to RuleActionType. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
ANNOTATION |
|
WEBHOOK |
|
from_str
classmethod
¶
from_str(val: str) -> RuleActionType | None
Convert string representation to RuleActionType.
| PARAMETER | DESCRIPTION |
|---|---|
val
|
String representation of RuleActionType.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RuleActionType | None
|
RuleActionType if conversion is successful, None otherwise. |
RuleAnnotationType
¶
Bases: Enum
Enum for rule annotation types.
| METHOD | DESCRIPTION |
|---|---|
from_str |
Convert string representation to RuleAnnotationType. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
DATA_REVIEW |
|
PHASE |
|
from_str
classmethod
¶
from_str(val: str) -> RuleAnnotationType | None
Convert string representation to RuleAnnotationType.
| PARAMETER | DESCRIPTION |
|---|---|
val
|
String representation of RuleAnnotationType.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RuleAnnotationType | None
|
RuleAnnotationType if conversion is successful, None otherwise. |
RuleCreate
pydantic-model
¶
Bases: RuleCreateUpdateBase, ModelCreate[CreateRuleRequest]
Model for creating a new Rule.
Note: - asset_ids applies this rule to those assets. - asset_tag_ids applies this rule to assets with those tags.
Fields:
-
_field_helpers_called(set[str]) -
organization_id(str | None) -
client_key(str | None) -
asset_ids(list[str] | None) -
asset_tag_ids(list[str] | None) -
contextual_channels(list[str] | None) -
is_external(bool) -
evaluate_on_live_data(bool) -
name(str) -
description(str) -
expression(str) -
channel_references(list[ChannelReference]) -
action(RuleAction)
Validators:
-
_check_mapping_helpers
RuleUpdate
pydantic-model
¶
Bases: RuleCreateUpdateBase, ModelUpdate[Rule]
Model of the Rule fields that can be updated.
Note
- assets applies this rule to those assets.
- asset_tags applies this rule to assets with those tags.
- contextual_channels are shown by UI to give context when viewing an annotation, but are not part of rule evaluation.
Fields:
-
_field_helpers_called(set[str]) -
organization_id(str | None) -
client_key(str | None) -
asset_ids(list[str] | None) -
asset_tag_ids(list[str] | None) -
contextual_channels(list[str] | None) -
is_external(bool) -
evaluate_on_live_data(bool) -
name(str | None) -
description(str | None) -
expression(str | None) -
channel_references(list[ChannelReference] | None) -
action(RuleAction | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
RuleVersion
pydantic-model
¶
Bases: BaseType[RuleVersion, 'RuleVersion']
Model of a Rule Version.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
rule_id(str) -
rule_version_id(str) -
version(str) -
created_date(datetime) -
created_by_user_id(str) -
version_notes(str) -
generated_change_message(str) -
archived_date(datetime | None) -
is_archived(bool)
Validators:
-
_validate_timezones
Run
pydantic-model
¶
Bases: BaseType[Run, 'Run'], FileAttachmentsMixin
Run model representing a data collection run.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
description(str) -
created_date(datetime) -
modified_date(datetime) -
created_by_user_id(str) -
modified_by_user_id(str) -
organization_id(str) -
metadata(dict[str, str | float | bool]) -
tags(list[str]) -
asset_ids(list[str]) -
is_adhoc(bool) -
is_archived(bool) -
start_time(datetime | None) -
stop_time(datetime | None) -
duration(timedelta | None) -
default_report_id(str | None) -
client_key(str | None) -
archived_date(datetime | None)
Validators:
-
_validate_timezones
attachments
property
¶
attachments: list[FileAttachment]
Get all file attachments for this entity.
| RETURNS | DESCRIPTION |
|---|---|
list[FileAttachment]
|
A list of FileAttachments associated with this entity. |
check_is_supported_entity_type
staticmethod
¶
Check if the entity type is supported for file attachments.
| RETURNS | DESCRIPTION |
|---|---|
|
True if the entity type is supported, False otherwise. |
delete_attachment
¶
delete_attachment(
file_attachment: list[FileAttachment | str]
| FileAttachment
| str,
) -> None
Delete one or more file attachments.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
A single FileAttachment or list of FileAttachments to delete.
TYPE:
|
upload_attachment
¶
upload_attachment(
path: str | Path,
metadata: dict[str, Any] | None = None,
description: str | None = None,
organization_id: str | None = None,
) -> FileAttachment
Upload a file attachment to a remote file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to upload.
TYPE:
|
metadata
|
Optional metadata for the file (e.g., video/image metadata).
TYPE:
|
description
|
Optional description of the file.
TYPE:
|
organization_id
|
Optional organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The uploaded FileAttachment. |
update
¶
import_data
¶
import_data(
file_path: str | Path,
*,
asset: Asset | str | None = None,
config: ImportConfig | None = None,
data_type: DataTypeKey | None = None,
show_progress: bool | None = None,
) -> Job
Import data from a file into this run.
Convenience method that calls client.data_imports.import_from_path
with this run pre-filled. If the run has exactly one asset,
asset is inferred automatically.
| PARAMETER | DESCRIPTION |
|---|---|
file_path
|
Path to the local file to import.
TYPE:
|
asset
|
Asset object or asset name to import data into.
TYPE:
|
config
|
Import configuration. Auto-detected if omitted.
TYPE:
|
data_type
|
Explicit data type key for ambiguous formats.
TYPE:
|
show_progress
|
Display a progress spinner during upload.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job
|
A |
RunCreate
pydantic-model
¶
Bases: RunBase, ModelCreate[CreateRunRequest]
Create model for Run.
Fields:
-
_field_helpers_called(set[str]) -
description(str | None) -
start_time(datetime | None) -
stop_time(datetime | None) -
tags(list[str] | list[Tag] | None) -
metadata(dict[str, str | float | bool] | None) -
name(str) -
client_key(str | None) -
organization_id(str | None)
Validators:
-
_check_mapping_helpers -
_validate_time_fields
RunUpdate
pydantic-model
¶
Bases: RunBase, ModelUpdate[Run]
Update model for Run.
Fields:
-
_field_helpers_called(set[str]) -
description(str | None) -
start_time(datetime | None) -
stop_time(datetime | None) -
tags(list[str] | list[Tag] | None) -
metadata(dict[str, str | float | bool] | None) -
name(str | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers -
_validate_time_fields
to_proto_with_mask
¶
Convert to proto with field mask.
Tag
pydantic-model
¶
Bases: BaseType[Tag, 'Tag']
Model of the Sift Tag.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
name(str) -
created_date(datetime) -
created_by_user_id(str)
Validators:
-
_validate_timezones
TagCreate
pydantic-model
¶
Bases: TagCreateUpdateBase, ModelCreate[CreateTagRequest]
Create model for Tag.
Fields:
-
_field_helpers_called(set[str]) -
name(str)
Validators:
-
_check_mapping_helpers
TagUpdate
pydantic-model
¶
Bases: TagCreateUpdateBase, ModelUpdate[Tag]
Update model for Tag.
Fields:
-
_field_helpers_called(set[str]) -
name(str)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
TestMeasurement
pydantic-model
¶
Bases: BaseType[TestMeasurement, 'TestMeasurement'], SimulatedMixin
TestMeasurement model representing a measurement in a test.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
measurement_type(TestMeasurementType) -
name(str) -
test_step_id(str) -
test_report_id(str | None) -
numeric_value(float | None) -
string_value(str | None) -
boolean_value(bool | None) -
unit(str | None) -
numeric_bounds(NumericBounds | None) -
string_expected_value(str | None) -
passed(bool) -
timestamp(datetime) -
description(str | None) -
metadata(dict[str, str | float | bool] | None) -
channel_names(list[str] | None) -
_log_file(str | Path | None) -
_simulated(bool)
Validators:
-
_validate_timezones
is_simulated
property
¶
True when this instance was returned from the simulate path.
Set by the low-level wrapper when the call short-circuited to a
synthesized response (either SiftClient._simulate mode or per-call
log_file / simulate=True). False for entities returned from a
normal online call or constructed manually outside the SDK. Offline
mode also reports True since responses are synthesized prior to
replay.
update
¶
update(
update: TestMeasurementUpdate | dict,
update_step: bool = False,
log_file: str | Path | None = None,
) -> TestMeasurement
Update the TestMeasurement.
| PARAMETER | DESCRIPTION |
|---|---|
update
|
The update to apply to the TestMeasurement.
TYPE:
|
update_step
|
Whether to update the TestStep's status to failed if the TestMeasurement is being updated to failed.
TYPE:
|
log_file
|
If set, log the request to this file instead of making an API call.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TestMeasurement
|
The updated TestMeasurement. |
TestMeasurementCreate
pydantic-model
¶
Bases: TestMeasurementBase, ModelCreate[TestMeasurement]
Create model for TestMeasurement.
Fields:
-
_field_helpers_called(set[str]) -
numeric_value(float | None) -
string_value(str | None) -
boolean_value(bool | None) -
unit(str | None) -
numeric_bounds(NumericBounds | None) -
string_expected_value(str | None) -
measurement_type(TestMeasurementType | None) -
description(str | None) -
metadata(dict[str, str | float | bool] | None) -
channel_names(list[str] | list[Channel] | None) -
name(str) -
test_step_id(str) -
passed(bool) -
timestamp(datetime)
Validators:
-
_check_mapping_helpers -
_truncate_description→description
TestMeasurementType
¶
TestReport
pydantic-model
¶
Bases: BaseType[TestReport, 'TestReport'], FileAttachmentsMixin, SimulatedMixin
TestReport model representing a test report.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
status(TestStatus) -
name(str) -
test_system_name(str) -
test_case(str) -
start_time(datetime) -
end_time(datetime) -
metadata(dict[str, str | float | bool]) -
serial_number(str | None) -
part_number(str | None) -
system_operator(str | None) -
run_id(str | None) -
archived_date(datetime | None) -
is_archived(bool) -
_log_file(str | Path | None) -
_simulated(bool)
Validators:
-
_validate_timezones
is_simulated
property
¶
True when this instance was returned from the simulate path.
Set by the low-level wrapper when the call short-circuited to a
synthesized response (either SiftClient._simulate mode or per-call
log_file / simulate=True). False for entities returned from a
normal online call or constructed manually outside the SDK. Offline
mode also reports True since responses are synthesized prior to
replay.
attachments
property
¶
attachments: list[FileAttachment]
Get all file attachments for this entity.
| RETURNS | DESCRIPTION |
|---|---|
list[FileAttachment]
|
A list of FileAttachments associated with this entity. |
check_is_supported_entity_type
staticmethod
¶
Check if the entity type is supported for file attachments.
| RETURNS | DESCRIPTION |
|---|---|
|
True if the entity type is supported, False otherwise. |
delete_attachment
¶
delete_attachment(
file_attachment: list[FileAttachment | str]
| FileAttachment
| str,
) -> None
Delete one or more file attachments.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
A single FileAttachment or list of FileAttachments to delete.
TYPE:
|
upload_attachment
¶
upload_attachment(
path: str | Path,
metadata: dict[str, Any] | None = None,
description: str | None = None,
organization_id: str | None = None,
) -> FileAttachment
Upload a file attachment to a remote file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to upload.
TYPE:
|
metadata
|
Optional metadata for the file (e.g., video/image metadata).
TYPE:
|
description
|
Optional description of the file.
TYPE:
|
organization_id
|
Optional organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The uploaded FileAttachment. |
update
¶
update(
update: TestReportUpdate | dict,
log_file: str | Path | None = None,
) -> TestReport
Update the TestReport.
If log_file is omitted, the resource layer falls back to the value
cached on self from the create call (offline/logging mode).
TestReportCreate
pydantic-model
¶
Bases: TestReportBase, ModelCreate[CreateTestReportRequest]
Create model for TestReport.
Fields:
-
_field_helpers_called(set[str]) -
status(TestStatus | None) -
metadata(dict[str, str | float | bool] | None) -
serial_number(str | None) -
part_number(str | None) -
system_operator(str | None) -
run_id(str | None) -
name(str) -
test_system_name(str) -
test_case(str) -
start_time(datetime) -
end_time(datetime)
Validators:
-
_check_mapping_helpers
TestReportUpdate
pydantic-model
¶
Bases: TestReportBase, ModelUpdate[TestReport]
Update model for TestReport.
Fields:
-
_field_helpers_called(set[str]) -
status(TestStatus | None) -
metadata(dict[str, str | float | bool] | None) -
serial_number(str | None) -
part_number(str | None) -
system_operator(str | None) -
run_id(str | None) -
name(str | None) -
test_system_name(str | None) -
test_case(str | None) -
start_time(datetime | None) -
end_time(datetime | None) -
is_archived(bool | None)
Validators:
-
_check_mapping_helpers
to_proto_with_mask
¶
Convert to proto with field mask.
TestStatus
¶
Bases: Enum
TestStatus enum.
| ATTRIBUTE | DESCRIPTION |
|---|---|
UNSPECIFIED |
|
DRAFT |
|
PASSED |
|
FAILED |
|
ABORTED |
|
ERROR |
|
IN_PROGRESS |
|
SKIPPED |
|
TestStep
pydantic-model
¶
Bases: BaseType[TestStep, 'TestStep'], FileAttachmentsMixin, SimulatedMixin
TestStep model representing a step in a test.
Fields:
-
id_(str | None) -
proto(Any | None) -
_client(SiftClient | None) -
test_report_id(str) -
parent_step_id(str | None) -
name(str) -
description(str | None) -
step_type(TestStepType) -
step_path(str) -
status(TestStatus) -
start_time(datetime) -
end_time(datetime) -
error_info(ErrorInfo | None) -
metadata(dict[str, str | float | bool] | None) -
_log_file(str | Path | None) -
_simulated(bool)
Validators:
-
_validate_timezones
is_simulated
property
¶
True when this instance was returned from the simulate path.
Set by the low-level wrapper when the call short-circuited to a
synthesized response (either SiftClient._simulate mode or per-call
log_file / simulate=True). False for entities returned from a
normal online call or constructed manually outside the SDK. Offline
mode also reports True since responses are synthesized prior to
replay.
attachments
property
¶
attachments: list[FileAttachment]
Get all file attachments for this entity.
| RETURNS | DESCRIPTION |
|---|---|
list[FileAttachment]
|
A list of FileAttachments associated with this entity. |
measurements
property
¶
measurements: list[TestMeasurement]
Get the TestMeasurements for the TestStep.
check_is_supported_entity_type
staticmethod
¶
Check if the entity type is supported for file attachments.
| RETURNS | DESCRIPTION |
|---|---|
|
True if the entity type is supported, False otherwise. |
delete_attachment
¶
delete_attachment(
file_attachment: list[FileAttachment | str]
| FileAttachment
| str,
) -> None
Delete one or more file attachments.
| PARAMETER | DESCRIPTION |
|---|---|
file_attachment
|
A single FileAttachment or list of FileAttachments to delete.
TYPE:
|
upload_attachment
¶
upload_attachment(
path: str | Path,
metadata: dict[str, Any] | None = None,
description: str | None = None,
organization_id: str | None = None,
) -> FileAttachment
Upload a file attachment to a remote file.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
The path to the file to upload.
TYPE:
|
metadata
|
Optional metadata for the file (e.g., video/image metadata).
TYPE:
|
description
|
Optional description of the file.
TYPE:
|
organization_id
|
Optional organization ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FileAttachment
|
The uploaded FileAttachment. |
update
¶
update(
update: TestStepUpdate | dict,
log_file: str | Path | None = None,
) -> TestStep
Update the TestStep.
If log_file is omitted, the resource layer falls back to the value
cached on self from the create call (offline/logging mode).
TestStepCreate
pydantic-model
¶
Bases: TestStepBase, ModelCreate[TestStep]
Create model for TestStep.
Fields:
-
_field_helpers_called(set[str]) -
parent_step_id(str | None) -
description(str | None) -
error_info(ErrorInfo | None) -
metadata(dict[str, str | float | bool] | None) -
test_report_id(str) -
name(str) -
step_type(TestStepType) -
step_path(str) -
status(TestStatus) -
start_time(datetime) -
end_time(datetime)
Validators:
-
_check_mapping_helpers