cmem_client.repositories.workspace_configs¤
Repository for the custom workspace configurations of DataIntegration.
Provides WorkspaceConfigsRepository for reading, creating, updating and deleting the workspace configuration profiles, and for importing and exporting them as JSON. The effective default profile is merged from the system and project defaults.
Examples:
List the profiles and read the effective default:
>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> list(client.workspace_configs)
>>> client.workspace_configs["default"]
>>> client.workspace_configs.project_default
Export a profile to a JSON file and import it into another deployment:
>>> from pathlib import Path
>>> from cmem_client.repositories.protocols.import_item import ImportConflictPolicy
>>> from cmem_client.repositories.workspace_configs import WorkspaceConfigsImportConfig
>>> client.workspace_configs.export_item(key="default", path=Path("profiles.json"))
>>> client.workspace_configs.import_item(
... path=Path("profiles.json"),
... key="default",
... on_conflict=ImportConflictPolicy.REPLACE,
... configuration=WorkspaceConfigsImportConfig(replace_id=True),
... )
Classes:
- WorkspaceConfigsCreateConfig – Custom workspace configuration creation config.
- WorkspaceConfigsDeleteConfig – Custom workspace configuration deletion config.
- WorkspaceConfigsExportConfig – Custom workspace configuration export config.
- WorkspaceConfigsImportConfig – Custom workspace configuration import config.
- WorkspaceConfigsRepository – Repository for Explore (DataPlatform) workspace configurations.
- WorkspaceConfigsUpdateConfig – Custom workspace configuration update config.
WorkspaceConfigsCreateConfig¤
Bases: CreateConfig
Custom workspace configuration creation config.
Attributes:
- model_config –
WorkspaceConfigsDeleteConfig¤
Bases: DeleteConfig
Custom workspace configuration deletion config.
Attributes:
- model_config –
WorkspaceConfigsExportConfig¤
Bases: ExportConfig
Custom workspace configuration export config.
Attributes:
- model_config –
WorkspaceConfigsImportConfig¤
Bases: ImportConfig
Custom workspace configuration import config.
Attributes:
- use_archive_handler (
bool) – Defaults to False here, unlike the base class, so the JSON file is read directly instead of being unpacked by the ArchiveHandler. - replace_id (
bool) – If True and the file contains exactly one configuration, adopt the given key as its id instead of failing because no entry matches the key.
model_config¤
replace_id¤
use_archive_handler¤
WorkspaceConfigsRepository¤
Bases: PlainListRepository, DeleteItemProtocol, CreateItemProtocol, UpdateItemProtocol, ImportItemProtocol, ExportItemProtocol
Repository for Explore (DataPlatform) workspace configurations.
Provides access to all workspace configurations: the system default (fetched from /api/conf/workspaces/systemDefault) followed by custom workspace configurations (fetched from /api/conf/workspaces/customWorkspaces). Custom workspace configurations support full CRUD operations.
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
- export_item – Export an item from the repository to a file path.
- fetch_data – Fetch simple list from a JSON endpoint via a type adapter
- get_export_payload – Return the export-ready payload for the given profile ID.
- import_item – Import an exported file to the repository
- items – Get the items of the repository
- keys – Get the keys of the repository
- migrate – Trigger workspace configuration migration on the DataPlatform.
- 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 - project_default (
WorkspaceConfig) – Return the raw project-level default overrides (not merged with system default).
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
export_item¤
Export an item from the repository to a file path.
Parameters:
- key (
str) – The key identifying the item to export. - path (
Path | None) – The target file path for export. If None, a path will be generated. - replace (
bool) – Whether to replace existing files at the target path. - configuration (
ExportItemConfig_contra | None) – Optional configuration for export behavior.
Returns:
Path– The actual path where the item was exported.
Raises:
RepositoryItemNotFoundError– If the specified item key is not found.RepositoryReadError– If there’s an error during export or path mismatch.
fetch_data¤
Fetch simple list from a JSON endpoint via a type adapter
Use this method to fetch data when your result set is an array of objects.
get_export_payload¤
Return the export-ready payload for the given profile ID.
For the default workspace, returns the raw project-level overrides (not merged with system defaults) to ensure a clean export/import round-trip. For custom workspaces, returns the full config excluding the computed label.
Parameters:
- key (
str) – The profile ID of the workspace configuration to serialize.
Returns:
dict– A dict ready for JSON serialization.
import_item¤
Import an exported file to the repository
By default, automatically handles zip files, directories, and single files using ImportItem model. Can be disabled by setting use_archive_handler=False in the configuration.
Returns:
str– The key of the imported item.
Raises:
RepositoryModificationError– If the item already exists and the conflict policy is FAIL, if the import type is not allowed for this repository, if the import request failed, or if the item is not present afterwards.
items¤
Get the items of the repository
keys¤
Get the keys of the repository
logger¤
Gets the client logger
migrate¤
Trigger workspace configuration migration on the DataPlatform.
Instructs the DataPlatform to migrate all workspace configurations that are flagged as needing migration (reported in StatusInfo.explore.workspaces_to_migrate).
Raises:
HTTPStatusError– If the migration request fails.
project_default¤
Return the raw project-level default overrides (not merged with system default).
Use this for export to preserve the round-trip: export raw overrides, import back to projectDefault without accumulating redundant system values.
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
WorkspaceConfigsUpdateConfig¤
Bases: UpdateConfig
Custom workspace configuration update config.
Attributes:
- model_config –