Skip to content

Transactional

Note

This Class is not meant to be instantiated directly, but rather accessed through the transactional Property on an instance of AsyncClient. For more details, see the Guide.

list_modules async

list_modules() -> list[Module]

Lists all the Modules in the Model.

Returns:

Type Description
list[Module]

The List of Modules.

get_model_status async

get_model_status() -> ModelStatus

Gets the current status of the Model.

Returns:

Type Description
ModelStatus

The current status of the Model.

list_line_items async

list_line_items(only_module_id: int | None = None) -> list[LineItem]

Lists all the Line Items in the Model.

Parameters:

Name Type Description Default
only_module_id int | None

If provided, only Line Items from this Module will be returned.

None

Returns:

Type Description
list[LineItem]

All Line Items on this Model.

list_lists async

list_lists() -> list[List]

Lists all the Lists in the Model.

Returns:

Type Description
list[List]

All Lists on this model.

get_list_metadata async

get_list_metadata(list_id: int) -> ListMetadata

Gets the metadata for a List.

Parameters:

Name Type Description Default
list_id int

The ID of the List.

required

Returns:

Type Description
ListMetadata

The metadata for the List.

get_list_items async

get_list_items(list_id: int) -> list[ListItem]

Gets all the items in a List.

Parameters:

Name Type Description Default
list_id int

The ID of the List.

required

Returns:

Type Description
list[ListItem]

All items in the List.

insert_list_items async

insert_list_items(
    list_id: int, items: list[dict[str, str | int | dict]]
) -> InsertionResult

Insert new items to the given list. The items must be a list of dictionaries with at least the keys code and name. You can optionally pass further keys for parents, extra properties etc. If you pass a long list, it will be split into chunks of 100,000 items, the maximum allowed by the API.

Warning: If one or some of the requests timeout during large batch operations, the operation may actually complete on the server. Retries for these chunks will then report these items as "ignored" rather than "added", leading to misleading results. The results in Anaplan will be correct, but this function may report otherwise. Be generous with your timeouts and retries if you are using this function for large batch operations.

Parameters:

Name Type Description Default
list_id int

The ID of the List.

required
items list[dict[str, str | int | dict]]

The items to insert into the List.

required

Returns:

Type Description
InsertionResult

The result of the insertion, indicating how many items were added, ignored or failed.

delete_list_items async

delete_list_items(list_id: int, items: list[dict[str, str | int]]) -> int

Deletes items from a List. If you pass a long list, it will be split into chunks of 100,000 items, the maximum allowed by the API.

Warning: If one or some of the requests timeout during large batch operations, the operation may actually complete on the server. Retries for these chunks will then report none of these items as deleted, since on the retry none are removed, leading to misleading results. The results in Anaplan will be correct, but this function may report otherwise. Be generous with your timeouts and retries if you are using this function for large batch operations.

Parameters:

Name Type Description Default
list_id int

The ID of the List.

required
items list[dict[str, str | int]]

The items to delete from the List. Must be a dict with either code or id as the keys to identify the records to delete.

required

reset_list_index async

reset_list_index(list_id: int) -> None

Resets the index of a List. The List must be empty to do so.

Parameters:

Name Type Description Default
list_id int

The ID of the List.

required

update_module_data async

update_module_data(
    module_id: int, data: list[dict[str, Any]]
) -> int | dict[str, Any]

Write the passed items to the specified module. If successful, the number of cells changed is returned, if only partially successful or unsuccessful, the response with the according details is returned instead.

You can update a maximum of 100,000 cells or 15 MB of data (whichever is lower) in a single request. You must chunk your data accordingly. This is not done by this SDK, since it is discouraged. For larger imports, you should use the Bulk API instead.

For more details see: https://anaplan.docs.apiary.io/#UpdateModuleCellData.

Parameters:

Name Type Description Default
module_id int

The ID of the Module.

required
data list[dict[str, Any]]

The data to write to the Module.

required

Returns:

Type Description
int | dict[str, Any]

The number of cells changed or the response with the according error details.