Data Columns
albert.collections.data_columns.DataColumnCollection
Bases: BaseCollection
Manage Data Columns in the Albert platform.
A Data Column (DAC, IDs DAC...) is the definition of a single measured
result variable, such as Viscosity or APHA Color. Data columns are the
reusable building blocks of a Data Template's results: a
DataTemplate references them through
its data_column_values, and the values recorded against a data column
during experiments are stored as Property Data.
This collection is accessed as client.data_columns.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for data column requests. |
Methods:
| Name | Description |
|---|---|
get_all |
Get data columns matching optional filters. |
get_by_id |
Get a single data column by its ID. |
get_by_name |
Get a single data column by its exact name. |
create |
Create a new data column. |
get_or_create |
Return the existing data column matching by name, or create it. |
update |
Update an existing data column. |
delete |
Delete a data column by its ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/data_columns.py
get_by_name
get_by_name(*, name: str) -> DataColumn | None
Get a single data column by its exact name.
Matching is case-insensitive. To retrieve multiple columns or use partial
matching, use get_all instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the data column to retrieve (e.g. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn or None
|
The matching data column, or None if no exact match is found. |
Source code in src/albert/collections/data_columns.py
get_by_id
get_by_id(*, id: DataColumnId) -> DataColumn
Get a single data column by its ID.
To find a column without knowing its ID, use get_by_name or
get_all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DataColumnId
|
The Data Column ID (format |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The fully populated data column. |
Source code in src/albert/collections/data_columns.py
get_all
get_all(
*,
order_by: OrderBy = DESCENDING,
ids: DataColumnId | list[DataColumnId] | None = None,
name: str | list[str] | None = None,
exact_match: bool | None = None,
default: bool | None = None,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[DataColumn]
Get data columns matching the given filters.
Results are returned as a lazily paginated iterator, so iterating fetches
additional pages on demand. To retrieve a single column by its exact name,
use get_by_name; by its ID, use get_by_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order_by
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
ids
|
DataColumnId or list[DataColumnId]
|
Filter by one or more Data Column IDs (format |
None
|
name
|
str or list[str]
|
Filter by name(s). |
None
|
exact_match
|
bool
|
When True, the |
None
|
default
|
bool
|
When True, return only default data columns. |
None
|
start_key
|
str
|
Pagination key to resume from. Usually left unset. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[DataColumn]
|
A lazily paginated iterator of matching data columns. |
Source code in src/albert/collections/data_columns.py
create
create(*, data_column: DataColumn) -> DataColumn
Create a new data column.
To avoid creating a duplicate when a column with the same name may already
exist, use get_or_create instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_column
|
DataColumn
|
The data column to create. |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The newly created data column, populated with its assigned Data Column ID. |
Source code in src/albert/collections/data_columns.py
get_or_create
get_or_create(*, data_column: DataColumn) -> DataColumn
Return the existing data column matching by name, or create it.
If a data column with the same name already exists, that existing column is
returned instead of creating a duplicate; otherwise a new column is created
via create.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_column
|
DataColumn
|
The data column to get or create. Its |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The existing or newly created data column. |
Source code in src/albert/collections/data_columns.py
delete
delete(*, id: DataColumnId) -> None
Delete a data column by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
DataColumnId
|
The Data Column ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/data_columns.py
update
update(*, data_column: DataColumn) -> DataColumn
Update an existing data column.
Fetch the column (e.g. with get_by_id), modify the updatable fields
on the returned object, then pass it here. Only the fields listed in Notes
are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_column
|
DataColumn
|
The data column to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
DataColumn
|
The updated data column as registered in Albert. |
Notes
The following fields can be updated: metadata, name.