cmem_client.repositories.variables¤
Repository for the variables of DataIntegration projects.
Provides VariablesRepository for creating, updating and deleting project variables.
Variables are keyed by the composite key project_id:variable_name, so a single
repository spans the variables of all projects.
Examples:
Create a variable in a project and read its value back:
>>> from cmem_client.client import Client
>>> from cmem_client.models.variable import Variable
>>> client = Client.from_env()
>>> client.variables.create_item(
... Variable(name="greeting", project_id="my-project", value="hello")
... )
>>> client.variables["my-project:greeting"].value
>>> client.variables.get_item("my-project", "greeting").value
List every variable of the deployment and delete one:
Classes:
- VariableCreateConfig – Variable creation configuration.
- VariableDeleteConfig – Variable deletion configuration.
- VariableUpdateConfig – Variable update configuration.
- VariablesRepository – Repository for project variables.
VariableCreateConfig¤
Bases: CreateConfig
Variable creation configuration.
Attributes:
- model_config –
VariableDeleteConfig¤
Bases: DeleteConfig
Variable deletion configuration.
Attributes:
- model_config –
VariableUpdateConfig¤
Bases: UpdateConfig
Variable update configuration.
Attributes:
- model_config –
VariablesRepository¤
Bases: Repository, DeleteItemProtocol, CreateItemProtocol, UpdateItemProtocol
Repository for project variables.
Manages project variables across all projects in the Corporate Memory
DataIntegration (build) environment. Variables are fetched per project and
stored with combined keys in the form project_id:variable_name.
Functions:
- create_item – Create (add) a new item to the repository
- delete_all – Delete all items from the repository
- delete_item – Delete an item from the repository
- fetch_data – Fetch all variables from all projects.
- get_item – Get a single variable by project and name.
- items – Get the items of the repository
- keys – Get the keys of the repository
- raise_modification_error – Raise an exception if needed
- update_item – Update an existing item in the repository.
- values – Get the values of the repository
Attributes:
- logger (
Logger) – Gets the client logger
create_item¤
Create (add) a new item to the repository
Parameters:
- item (
ItemType) – The item to add to the repository - skip_if_existing (
bool) – If true, creating already existing items will be ignored - configuration (
CreateItemConfig_contra | None) – Optional configuration
Raises:
RepositoryModificationError– if an error occurs while creating the itemHTTPError– for any other http error
delete_all¤
Delete all items from the repository
delete_item¤
Delete an item from the repository
Parameters:
- key (
str) – The key of the item to delete - skip_if_missing (
bool) – If True, it is ignored if the deleted item even exists - configuration (
DeleteItemConfig) – Optional configuration for deletion
Raises:
RepositoryModificationError– if an error occurs while creating the itemHTTPError– for any other http error
fetch_data¤
Fetch all variables from all projects.
get_item¤
Get a single variable by project and name.
Parameters:
- project_id (
str) – The project ID. - variable_name (
str) – The variable name.
Returns:
Variable– Variable model.
Raises:
HTTPStatusError– If the variable is not found or the request fails.
items¤
Get the items of the repository
keys¤
Get the keys of the repository
logger¤
Gets the client logger
raise_modification_error¤
Raise an exception if needed
update_item¤
Update an existing item in the repository.
Parameters:
- item (
ItemType) – The item to update in the repository. - configuration (
UpdateItemConfig_contra | None) – Optional configuration for the update operation.
Raises:
RepositoryModificationError– If the item does not exist or an error occurs.HTTPError– For any other HTTP error.
values¤
Get the values of the repository