Batch Data
albert.collections.batch_data
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL to prefix to all requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
BatchData
Bases: BaseResource
last_key
class-attribute
instance-attribute
last_key: str | None = Field(default=None, alias='lastKey')
product
class-attribute
instance-attribute
product: list[BatchDataColumn] | None = Field(
default=None, alias="Product"
)
rows
class-attribute
instance-attribute
rows: list[BatchDataRow] | None = Field(
default=None, alias="Rows"
)
BatchDataCollection
BatchDataCollection(*, session: AlbertSession)
Bases: BaseCollection
BatchDataCollection is a collection class for managing BatchData entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create_batch_data |
Create a new batch data entry. |
get |
Retrieve BatchData by ID. |
update_used_batch_amounts |
Update the used batch amounts for a given task ID. |
Source code in src/albert/collections/batch_data.py
create_batch_data
create_batch_data(*, task_id: TaskId)
Create a new batch data entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task for which the batch data is being created. |
required |
Returns:
Type | Description |
---|---|
BatchData
|
The created BatchData object. |
Source code in src/albert/collections/batch_data.py
get
get(
*,
id: TaskId,
type: BatchDataType = TASK_ID,
limit: int = 100,
start_key: str | None = None,
order_by: OrderBy = DESCENDING,
) -> BatchData
Retrieve BatchData by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
Unique Id of the selected type. |
required |
type
|
BatchDataType
|
Type of Id for which BatchData will be fetched. |
TASK_ID
|
limit
|
int
|
The maximum number of list entities to return. |
100
|
start_key
|
str
|
The primary key of the first item that this operation will evaluate. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING |
DESCENDING
|
Returns:
Type | Description |
---|---|
BatchData
|
The BatchData object. |
Source code in src/albert/collections/batch_data.py
update_used_batch_amounts
update_used_batch_amounts(
*, task_id: str, patches=list[BatchValuePatchPayload]
) -> None
Update the used batch amounts for a given task ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The ID of the task to update. |
required |
patches
|
list[BatchValuePatchPayload]
|
The patch payloads containing the data to update. |
list[BatchValuePatchPayload]
|
Returns:
Type | Description |
---|---|
None
|
This method does not return anything. |
Source code in src/albert/collections/batch_data.py
BatchValuePatchPayload
Bases: BaseAlbertModel