Imports
imports
Service class for handling data imports into Kaleidoscope workspace.
This module provides the ImportsService class, which facilitates pushing data records
into the Kaleidoscope system. It supports flexible data import operations, allowing
organization by experiments, programs, and data sources.
Classes:
| Name | Description |
|---|---|
ImportsService |
Service for handling data imports into the Kaleidoscope workspace, providing methods to push records organized by source, experiment, program, record views, and set names. |
Example
key_fields = ["id", "timestamp"]
records = [
{"id": "001", "timestamp": "2024-01-01", "value": 42.5, "status": "active"},
{"id": "002", "timestamp": "2024-01-02", "value": 38.7, "status": "pending"}
]
# Push data to a specific source and experiment
response = client.imports.push_data(
key_field_names=key_fields,
data=records,
source_id="data_source_123",
operation_id="exp_456",
set_name="january_batch"
)
ImportsService
ImportsService(client: KaleidoscopeClient)
Service class for handling data imports into Kaleidoscope workspace.
This service provides functionality to push data records into the workspace, with support for organizing data by sources, experiments, programs, and record views.
Methods:
| Name | Description |
|---|---|
push_data |
Imports data records into the workspace with various organizational options. |
Source code in kalpy/imports.py
42 43 | |
push_data
push_data(key_field_names: list[str], data: list[dict[str, Any]], source_id: str | None = None, operation_id: str | None = None, program_id: str | None = None, record_view_ids: list[str] | None = [], set_name: str | None = None) -> Any
Import data into the workspace.
Sends a list of records, each represented as a dictionary of field names and values, to the Kaleidoscope workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_field_names
|
list[str]
|
List of field names that serve as keys for the records. |
required |
data
|
list[dict[str, Any]]
|
List of records to import, each as a dictionary mapping field names to values. |
required |
source_id
|
str
|
Identifier for the data source. If provided, data is imported under this source. |
None
|
operation_id
|
str
|
Identifier for the experiment. If provided, data is imported into this specific experiment. |
None
|
program_id
|
str
|
Identifier for the program. If provided, data is imported under this program. |
None
|
record_view_ids
|
list[str]
|
List of record view IDs to associate with the imported data. |
[]
|
set_name
|
str
|
Name of the set to which the imported data belongs. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Response object from the client's POST request to the import endpoint. |
Source code in kalpy/imports.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |