List

async AsyncCogniteClient.data_modeling.files.list(
*,
source: View | ViewId | tuple[str, str, str] = ViewId(space='cdf_cdm', external_id='CogniteFile', version='v1'),
space: str | SequenceNotStr[str] | None = None,
sort: Sequence[InstanceSort | dict] | InstanceSort | dict | None = None,
filter: Filter | dict[str, Any] | None = None,
limit: int | None = 25,
) NodeList[Node]

List file nodes.

Only file nodes will be returned, regardless of the source passed.

Parameters:
  • source (View | ViewId | tuple[str, str, str]) – The view to fetch properties from. Defaults to CogniteFile.

  • space (str | SequenceNotStr[str] | None) – Restrict results to this space (or list of spaces).

  • sort (Sequence[InstanceSort | dict] | InstanceSort | dict | None) – Sort order for the results.

  • filter (Filter | dict[str, Any] | None) – Advanced filter to apply. See filters.

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

Returns:

The matching files.

Return type:

NodeList[Node]

Examples

List a few files:

>>> from cognite.client import CogniteClient
>>> client = CogniteClient()
>>> res = client.data_modeling.files.list(limit=5)

List all files in a specific space:

>>> res = client.data_modeling.files.list(space="my-space", limit=None)

Fetch properties from a custom view (note, only files will be returned), and apply a custom filter on the file name:

>>> from cognite.client.data_classes.data_modeling import ViewId
>>> from cognite.client.data_classes import filters
>>> view_id = ViewId("my-space", "MyFileExtension", "v1")
>>> res = client.data_modeling.files.list(
...     source=view_id,
...     filter=filters.Prefix(view_id.as_property_ref("name"), "report"),
...     limit=None,
... )