Retrieve
- async AsyncCogniteClient.data_modeling.files.retrieve(
- node_ids: NodeId | tuple[str, str] | Sequence[NodeId] | Sequence[tuple[str, str]],
- *,
- source: View | ViewId | tuple[str, str, str] = ViewId(space='cdf_cdm', external_id='CogniteFile', version='v1'),
Retrieve one or more files by instance ID.
Only nodes that are files (i.e. have data in the CogniteFile view) will be returned. If a single instance ID is requested and it is not found,
Noneis returned.- Parameters:
- Returns:
A single
Node(orNoneif not found) when given a single identifier, or aNodeListwhen given a sequence.- Return type:
Examples
Retrieve a single file by instance ID:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes.data_modeling import NodeId >>> client = CogniteClient() >>> res = client.data_modeling.files.retrieve(NodeId("my-space", "my-file"))
Using a tuple shorthand:
>>> res = client.data_modeling.files.retrieve(("my-space", "my-file"))
Retrieve multiple file nodes:
>>> res = client.data_modeling.files.retrieve( ... [("my-space", "file-1"), ("my-space", "file-2")] ... )
Fetch properties from a custom view (note, only files will be returned):
>>> from cognite.client.data_classes.data_modeling import ViewId >>> res = client.data_modeling.files.retrieve( ... NodeId("my-space", "my-file"), ... source=ViewId("my-space", "MyFileExtension", "v1"), ... )