class milkstraw_client.source_data.SourceData(id: str, name: str, status: str)[source]

Bases: object

Handles interactions with the source data backend APIs.

This class provides methods to upload, retrieve, list, and download source data.

id

The unique identifier of the source data.

Type:

str

name

The name of the source data.

Type:

str

status

The status of the source data.

Type:

str

static download(id: str, file_path: str) str[source]

Download the content of source data by its unique identifier.

Parameters:
  • id (str) – The unique identifier of the source data.

  • file_path (str) – The path to save the downloaded file.

Returns:

The path to the downloaded file.

Return type:

str

static get(id: str) SourceData[source]

Retrieve source data by its unique identifier.

Parameters:

id (str) – The unique identifier of the source data.

Returns:

An instance of the SourceData class representing the retrieved source data.

Return type:

SourceData

static list() list[milkstraw_client.source_data.SourceData][source]

List all available source data.

Returns:

A list of SourceData instances representing the available source data.

Return type:

list[SourceData]

static upload(name: str, file_path: str, auto_primary_key: bool | None = None, primary_key_column: str | None = None) SourceData[source]

Upload source data to the backend.

Parameters:
  • name (str) – The name of the source data.

  • file_path (str) – The path to the source data file.

  • auto_primary_key (bool, optional) – Whether to automatically generate a primary key. Defaults to None.

  • primary_key_column (str, optional) – The name of the primary key column. Defaults to None.

Returns:

An instance of the SourceData class representing the uploaded source data.

Return type:

SourceData