Data Columns
albert.collections.data_columns
AlbertPaginator
AlbertPaginator(
*,
path: str,
mode: PaginationMode,
session: AlbertSession,
deserialize: Callable[
[Iterable[dict]], Iterable[ItemType]
],
params: dict[str, str] | None = None,
)
Bases: Iterator[ItemType]
Helper class for pagination through Albert endpoints.
Two pagination modes are possible:
- Offset-based via by the offset query parameter
- Key-based via by the startKey query parameter and 'lastKey' response field
A custom deserialize function is provided when additional logic is required to load
the raw items returned by the search listing, e.g., making additional Albert API calls.
Source code in src/albert/core/pagination.py
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
auth_manager: AlbertClientCredentials
| AlbertSSOClient
| 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 relative request paths (e.g., "https://app.albertinvent.com"). |
required |
token
|
str | None
|
A static JWT token for authentication. Ignored if |
None
|
auth_manager
|
AlbertClientCredentials | AlbertSSOClient
|
An authentication manager used to dynamically fetch and refresh tokens.
If provided, it overrides |
None
|
retries
|
int
|
The number of automatic retries on failed requests (default is 3). |
None
|
Methods:
| Name | Description |
|---|---|
request |
|
Source code in src/albert/core/session.py
request
Source code in src/albert/core/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
DataColumn
Bases: BaseResource
metadata
class-attribute
instance-attribute
DataColumnCollection
DataColumnCollection(*, session: AlbertSession)
Bases: BaseCollection
DataColumnCollection is a collection class for managing DataColumn entities in the Albert platform.
Methods:
| Name | Description |
|---|---|
create |
Create a new data column entity. |
delete |
Delete a data column entity. |
get_all |
Get all data column entities with optional filters. |
get_by_id |
Get a data column by its ID. |
get_by_name |
Get a data column by its name. |
update |
Update a data column entity. |
Source code in src/albert/collections/data_columns.py
create
create(*, data_column: DataColumn) -> DataColumn
Create a new data column entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_column
|
DataColumn
|
The data column object to create. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The created data column object. |
Source code in src/albert/collections/data_columns.py
delete
delete(*, id: str) -> None
Delete a data column entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the data column object to delete. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/data_columns.py
get_all
get_all(
*,
order_by: OrderBy = DESCENDING,
ids: str | list[str] | None = None,
name: str | list[str] | None = None,
exact_match: bool | None = None,
default: bool | None = None,
start_key: str | None = None,
limit: int = 100,
) -> Iterator[DataColumn]
Get all data column entities with optional filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
ids
|
str | list[str] | None
|
Data column IDs to filter the search by, default None. |
None
|
name
|
Union[str, None]
|
The name of the tag to filter by, by default None. |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
None
|
default
|
bool
|
Whether to return only default columns, by default None. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[DataColumn]
|
An iterator of DataColumns matching the provided criteria. |
Source code in src/albert/collections/data_columns.py
get_by_id
get_by_id(*, id) -> DataColumn
Get a data column by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the data column to get. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn | None
|
The data column object on match or None |
Source code in src/albert/collections/data_columns.py
get_by_name
get_by_name(*, name) -> DataColumn | None
Get a data column by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the data column to get. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn | None
|
The data column object on match or None |
Source code in src/albert/collections/data_columns.py
update
update(*, data_column: DataColumn) -> DataColumn
Update a data column entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_column
|
DataColumn
|
The updated data column object. The ID must be set and match an existing data column. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The updated data column object as registered in Albert. |