Skip to content

sift_py.data_import.csv

CLASS DESCRIPTION
CsvUploadService

CsvUploadService

CsvUploadService(rest_conf: SiftRestConfig)

Bases: _RestService

METHOD DESCRIPTION
simple_upload

Uploads the CSV file pointed to by path to the specified asset. This function will

upload

Uploads the CSV file pointed to by path using a custom CSV config.

upload_from_url

Uploads the CSV file pointed to by url using a custom CSV config.

ATTRIBUTE DESCRIPTION
RUN_PATH

UPLOAD_PATH

URL_PATH

RUN_PATH class-attribute instance-attribute

RUN_PATH = '/api/v2/runs'

UPLOAD_PATH class-attribute instance-attribute

UPLOAD_PATH = '/api/v1/data-imports:upload'

URL_PATH class-attribute instance-attribute

URL_PATH = '/api/v1/data-imports:url'

simple_upload

simple_upload(
    asset_name: str,
    path: Union[str, Path],
    first_data_row: int = 2,
    time_column: int = 1,
    time_format: TimeFormatType = ABSOLUTE_DATETIME,
    run_name: Optional[str] = None,
    run_id: Optional[str] = None,
    units_row: Optional[int] = None,
    descriptions_row: Optional[int] = None,
    relative_start_time: Optional[str] = None,
) -> DataImportService

Uploads the CSV file pointed to by path to the specified asset. This function will infer the data types and assume certain things about how the data is formatted. See the options below for what parameters can be overridden. Use upload if you need to specify a custom CSV config.

Override first_data_row to specify which is the first row with data. Default is 2. Override time_column to specify which column contains timestamp information. Default is 1. Override time_format to specify the time data format. Default is TimeFormatType.ABSOLUTE_DATETIME. Override run_name to specify the name of the run to create for this data. Default is None. Override run_id to specify the id of the run to add this data to. Default is None. Override units_row to specify which row contains unit information. Default is None. Override descriptions_row to specify which row contains channel description information. Default is None. Override relative_start_time if a relative time format is used. Default is None.

upload

upload(
    path: Union[str, Path],
    csv_config: CsvConfig,
    show_progress: bool = True,
) -> DataImportService

Uploads the CSV file pointed to by path using a custom CSV config.

PARAMETER DESCRIPTION
path

The path to the CSV file.

TYPE: Union[str, Path]

csv_config

The CSV config.

TYPE: CsvConfig

show_progress

Whether to show the status bar or not.

TYPE: bool DEFAULT: True

upload_from_url

upload_from_url(
    url: str, csv_config: CsvConfig
) -> DataImportService

Uploads the CSV file pointed to by url using a custom CSV config.