List containers

async AsyncCogniteClient.data_modeling.containers.list(
space: str | None = None,
limit: int | None = 10,
include_global: bool = False,
used_for: Literal['node', 'edge', 'record', 'all'] | Sequence[Literal['node', 'edge', 'record', 'all']] | None = None,
) ContainerList

List containers.

Parameters:
  • space (str | None) – The space to query

  • limit (int | None) – Maximum number of containers to return. Defaults to 10. Set to -1, float(“inf”) or None to return all items.

  • include_global (bool) – Whether the global containers should be returned.

  • used_for (ContainerUsedFor | Sequence[ContainerUsedFor] | None) – Only include containers marked for these purposes. If omitted, containers of every kind (nodes, edges, and records) are returned.

Returns:

List of requested containers

Return type:

ContainerList

Examples

List containers and limit to 5:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> container_list = client.data_modeling.containers.list(limit=5)

Filter containers by used_for. Note that “all” refers to containers that stores both nodes and edges:

>>> # High-volume data containers (records)
>>> record_containers = client.data_modeling.containers.list(used_for="record")
>>> # Containers that store ONLY nodes or ONLY edges (excludes "all"):
>>> containers = client.data_modeling.containers.list(used_for=["node", "edge"])
>>> # All containers that can store nodes:
>>> containers = client.data_modeling.containers.list(used_for=["node", "all"])

Iterate over containers, one-by-one:

>>> for container in client.data_modeling.containers():
...     container  # do something with the container

Iterate over chunks of containers to reduce memory load:

>>> for container_list in client.data_modeling.containers(chunk_size=10):
...     container_list  # do something with the containers