Transformations

TransformationsAPI

AsyncCogniteClient.transformations.cancel([...])

Cancel a running transformation.

AsyncCogniteClient.transformations.create(...)

Create one or more transformations.

AsyncCogniteClient.transformations.delete([...])

Delete one or more transformations.

AsyncCogniteClient.transformations.list([...])

List all transformations.

AsyncCogniteClient.transformations.preview([...])

Preview the result of a query.

AsyncCogniteClient.transformations.retrieve([...])

Retrieve a single transformation by id.

AsyncCogniteClient.transformations.retrieve_multiple([...])

Retrieve multiple transformations.

AsyncCogniteClient.transformations.run([...])

Run a transformation.

AsyncCogniteClient.transformations.update(item)

Update one or more transformations.

Transformation Schedules

AsyncCogniteClient.transformations.schedules.create(...)

Schedule the specified transformation with the specified configuration(s).

AsyncCogniteClient.transformations.schedules.delete([...])

Unschedule one or more transformations.

AsyncCogniteClient.transformations.schedules.list([...])

List all transformation schedules.

AsyncCogniteClient.transformations.schedules.retrieve([...])

Retrieve a single transformation schedule by the id or external id of its transformation.

AsyncCogniteClient.transformations.schedules.retrieve_multiple([...])

Retrieve multiple transformation schedules by the ids or external ids of the corresponding transformations.

AsyncCogniteClient.transformations.schedules.update(item)

Update one or more transformation schedules.

Transformation Notifications

AsyncCogniteClient.transformations.notifications.create(...)

Subscribe for notifications on the transformation errors.

AsyncCogniteClient.transformations.notifications.delete([id])

Deletes the specified notification subscriptions on the transformation.

AsyncCogniteClient.transformations.notifications.list([...])

List notification subscriptions.

Transformation Jobs

AsyncCogniteClient.transformations.jobs.list([...])

List all running transformation jobs.

AsyncCogniteClient.transformations.jobs.list_metrics(id)

List the metrics of a single transformation job.

AsyncCogniteClient.transformations.jobs.retrieve(id)

Retrieve a single transformation job by id.

AsyncCogniteClient.transformations.jobs.retrieve_multiple(ids)

Retrieve multiple transformation jobs by id.

Transformation Schema

AsyncCogniteClient.transformations.schema.retrieve(...)

Get expected schema for a transformation destination.

Data classes

class cognite.client.data_classes.transformations.ContainsAny(tags: list[str] | None = None)

Bases: TagsFilter

Return transformations that has one of the tags specified.

Parameters:

tags (list[str] | None) – The resource item contains at least one of the listed tags. The tags are defined by a list of external ids.

Examples

List only resources marked as a PUMP or as a VALVE:

>>> from cognite.client.data_classes.transformations import ContainsAny
>>> my_tag_filter = ContainsAny(tags=["PUMP", "VALVE"])
class cognite.client.data_classes.transformations.SessionDetails(
session_id: int | None = None,
client_id: str | None = None,
project_name: str | None = None,
)

Bases: object

Details of a source session.

Parameters:
  • session_id (int | None) – CDF source session ID

  • client_id (str | None) – Idp source client ID

  • project_name (str | None) – CDF source project name

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.Transformation(
id: int,
external_id: str,
name: str,
query: str,
destination: TransformationDestination,
conflict_mode: Literal['abort', 'delete', 'update', 'upsert'],
is_public: bool,
ignore_null_fields: bool,
created_time: int,
last_updated_time: int,
owner: str,
owner_is_current_user: bool,
source_oidc_credentials: OidcCredentials | None = None,
destination_oidc_credentials: OidcCredentials | None = None,
running_job: TransformationJob | None = None,
last_finished_job: TransformationJob | None = None,
blocked: TransformationBlockedInfo | None = None,
schedule: TransformationSchedule | None = None,
data_set_id: int | None = None,
source_nonce: NonceCredentials | None = None,
destination_nonce: NonceCredentials | None = None,
source_session: SessionDetails | None = None,
destination_session: SessionDetails | None = None,
tags: list[str] | None = None,
)

Bases: WriteableCogniteResourceWithClientRef[TransformationWrite], _TransformationsCredentialsMixin

The transformation resource allows transforming data in CDF.

Parameters:
  • id (int) – A server-generated ID for the object.

  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • name (str) – The name of the Transformation.

  • query (str) – SQL query of the transformation.

  • destination (TransformationDestination) – see TransformationDestination for options.

  • conflict_mode (Literal['abort', 'delete', 'update', 'upsert']) – What to do in case of id collisions: either “abort”, “upsert”, “update” or “delete”

  • is_public (bool) – Indicates if the transformation is visible to all in project or only to the owner.

  • ignore_null_fields (bool) – Indicates how null values are handled on updates: ignore or set null.

  • created_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • last_updated_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • owner (str) – Owner of the transformation: requester’s identity.

  • owner_is_current_user (bool) – Indicates if the transformation belongs to the current user.

  • source_oidc_credentials (OidcCredentials | None) – Configure the transformation to authenticate with the given oidc credentials key on the destination.

  • destination_oidc_credentials (OidcCredentials | None) – Configure the transformation to authenticate with the given oidc credentials on the destination.

  • running_job (TransformationJob | None) – Details for the job of this transformation currently running.

  • last_finished_job (TransformationJob | None) – Details for the last finished job of this transformation.

  • blocked (TransformationBlockedInfo | None) – Provides reason and time if the transformation is blocked.

  • schedule (TransformationSchedule | None) – Details for the schedule if the transformation is scheduled.

  • data_set_id (int | None) – No description.

  • source_nonce (NonceCredentials | None) – Single use credentials to bind to a CDF session for reading.

  • destination_nonce (NonceCredentials | None) – Single use credentials to bind to a CDF session for writing.

  • source_session (SessionDetails | None) – Details for the session used to read from the source project.

  • destination_session (SessionDetails | None) – Details for the session used to write to the destination project.

  • tags (list[str] | None) – No description.

as_write() TransformationWrite

Returns a writeable version of this transformation.

cancel() None

Cancel this transformation.

async cancel_async() None

Cancel this transformation.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

jobs() TransformationJobList

List all jobs for this transformation.

async jobs_async() TransformationJobList

List all jobs for this transformation.

run(
wait: bool = True,
timeout: float | None = None,
) TransformationJob

Run this transformation. :param wait: Whether to wait for the transformation to finish. Defaults to True. :type wait: bool :param timeout: How long to wait for the transformation to finish, in seconds. If None, wait indefinitely. Only used if wait is True. Defaults to None. :type timeout: float | None

Returns:

The started transformation job.

Return type:

TransformationJob

async run_async(
wait: bool = True,
timeout: float | None = None,
) TransformationJob

Run this transformation. :param wait: Whether to wait for the transformation to finish. Defaults to True. :type wait: bool :param timeout: How long to wait for the transformation to finish, in seconds. If None, wait indefinitely. Only used if wait is True. Defaults to None. :type timeout: float | None

Returns:

The started transformation job.

Return type:

TransformationJob

class cognite.client.data_classes.transformations.TransformationFilter(
include_public: bool = True,
name_regex: str | None = None,
query_regex: str | None = None,
destination_type: str | None = None,
conflict_mode: Literal['abort', 'delete', 'update', 'upsert'] | None = None,
cdf_project_name: str | None = None,
has_blocked_error: bool | None = None,
created_time: dict[str, Any] | TimestampRange | None = None,
last_updated_time: dict[str, Any] | TimestampRange | None = None,
data_set_ids: list[dict[str, Any]] | None = None,
tags: TagsFilter | None = None,
)

Bases: CogniteFilter

No description.

Parameters:
  • include_public (bool) – Whether public transformations should be included in the results. The default is true.

  • name_regex (str | None) – Regex expression to match the transformation name

  • query_regex (str | None) – Regex expression to match the transformation query

  • destination_type (str | None) – Transformation destination resource name to filter by.

  • conflict_mode (Literal['abort', 'delete', 'update', 'upsert'] | None) – Filters by a selected transformation action type: abort, upsert, update, delete

  • cdf_project_name (str | None) – Project name to filter by configured source and destination project

  • has_blocked_error (bool | None) – Whether only the blocked transformations should be included in the results.

  • created_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps

  • last_updated_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps

  • data_set_ids (list[dict[str, Any]] | None) – Return only transformations in the specified data sets with these ids, e.g. [{“id”: 1}, {“externalId”: “foo”}].

  • tags (TagsFilter | None) – Return only the resource matching the specified tags constraints. It only supports ContainsAny as of now.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.TransformationList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[TransformationWrite, Transformation], IdTransformerMixin

class cognite.client.data_classes.transformations.TransformationPreviewResult(
schema: TransformationSchemaColumnList,
results: list[dict],
)

Bases: CogniteResource

Allows previewing the result of a sql transformation before executing it.

Parameters:
  • schema (TransformationSchemaColumnList) – List of column descriptions.

  • results (list[dict]) – List of resulting rows. Each row is a dictionary where the key is the column name and the value is the entry.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.TransformationUpdate(id: int | None = None, external_id: str | None = None)

Bases: CogniteUpdate

Changes applied to transformation

Parameters:
  • id (int) – A server-generated ID for the object.

  • external_id (str) – External Id provided by client. Should be unique within the project.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (Literal[True]) – No description.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.TransformationWrite(
external_id: str,
name: str,
ignore_null_fields: bool = False,
query: str | None = None,
destination: TransformationDestination | None = None,
conflict_mode: Literal['abort', 'delete', 'update', 'upsert'] | None = None,
is_public: bool = True,
source_oidc_credentials: OidcCredentials | None = None,
destination_oidc_credentials: OidcCredentials | None = None,
data_set_id: int | None = None,
source_nonce: NonceCredentials | None = None,
destination_nonce: NonceCredentials | None = None,
tags: list[str] | None = None,
)

Bases: WriteableCogniteResource[TransformationWrite], _TransformationsCredentialsMixin

The transformation resource allows transforming data in CDF.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • name (str) – The name of the Transformation.

  • ignore_null_fields (bool) – Indicates how null values are handled on updates: ignore or set null.

  • query (str | None) – SQL query of the transformation.

  • destination (TransformationDestination | None) – see TransformationDestination for options.

  • conflict_mode (Literal['abort', 'delete', 'update', 'upsert'] | None) – What to do in case of id collisions: either “abort”, “upsert”, “update” or “delete”

  • is_public (bool) – Indicates if the transformation is visible to all in project or only to the owner.

  • source_oidc_credentials (OidcCredentials | None) – Configure the transformation to authenticate with the given oidc credentials key on the destination.

  • destination_oidc_credentials (OidcCredentials | None) – Configure the transformation to authenticate with the given oidc credentials on the destination.

  • data_set_id (int | None) – No description.

  • source_nonce (NonceCredentials | None) – Single use credentials to bind to a CDF session for reading.

  • destination_nonce (NonceCredentials | None) – Single use credentials to bind to a CDF session for writing.

  • tags (list[str] | None) – No description.

as_write() TransformationWrite

Returns this TransformationWrite instance.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.TransformationWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationWrite], ExternalIDTransformerMixin

class cognite.client.data_classes.transformations.schedules.TransformationSchedule(
id: int,
external_id: str,
created_time: int,
last_updated_time: int,
interval: str,
is_paused: bool,
)

Bases: TransformationScheduleCore

The transformation schedules resource allows running recurrent transformations.

Parameters:
  • id (int) – Transformation id.

  • external_id (str) – Transformation external id.

  • created_time (int) – Time when the schedule was created.

  • last_updated_time (int) – Time when the schedule was last updated.

  • interval (str) – Cron expression controls when the transformation will be run. Use http://www.cronmaker.com to create one.

  • is_paused (bool) – If true, the transformation is not scheduled.

as_write() TransformationScheduleWrite

Returns this TransformationSchedule as a TransformationScheduleWrite

class cognite.client.data_classes.transformations.schedules.TransformationScheduleCore(interval: str, is_paused: bool)

Bases: WriteableCogniteResource[TransformationScheduleWrite], ABC

The transformation schedules resource allows running recurrent transformations.

Parameters:
  • interval (str) – Cron expression controls when the transformation will be run. Use http://www.cronmaker.com to create one.

  • is_paused (bool) – If true, the transformation is not scheduled.

class cognite.client.data_classes.transformations.schedules.TransformationScheduleList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[TransformationScheduleWrite, TransformationSchedule], IdTransformerMixin

class cognite.client.data_classes.transformations.schedules.TransformationScheduleUpdate(
id: int | None = None,
external_id: str | None = None,
)

Bases: CogniteUpdate

Changes applied to transformation schedule

Parameters:
  • id (int) – Transformation id.

  • external_id (str) – Transformation externalId.

class cognite.client.data_classes.transformations.schedules.TransformationScheduleWrite(
interval: str,
id: int | None = None,
external_id: str | None = None,
is_paused: bool = False,
)

Bases: TransformationScheduleCore

The transformation schedules resource allows running recurrent transformations.

Parameters:
  • interval (str) – Cron expression controls when the transformation will be run. Use http://www.cronmaker.com to create one.

  • id (int | None) – Transformation id.

  • external_id (str | None) – Transformation external id.

  • is_paused (bool) – If true, the transformation is not scheduled.

as_write() TransformationScheduleWrite

Returns this TransformationScheduleWrite instance.

class cognite.client.data_classes.transformations.schedules.TransformationScheduleWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationScheduleWrite], IdTransformerMixin

class cognite.client.data_classes.transformations.notifications.TransformationNotification(
id: int,
transformation_id: int,
transformation_external_id: str,
destination: str,
created_time: int,
last_updated_time: int,
)

Bases: TransformationNotificationCore

The transformation notification resource allows configuring email alerts on events related to a transformation run. This is the read format of a transformation notification.

Parameters:
  • id (int) – A server-generated ID for the object.

  • transformation_id (int) – Transformation Id.

  • transformation_external_id (str) – Transformation external Id.

  • destination (str) – Email address where notifications should be sent.

  • created_time (int) – Time when the notification was created.

  • last_updated_time (int) – Time when the notification was last updated.

as_write() TransformationNotificationWrite

Returns this Asset in its writing format.

class cognite.client.data_classes.transformations.notifications.TransformationNotificationCore(destination: str)

Bases: WriteableCogniteResource[TransformationNotificationWrite], ABC

The transformation notification resource allows configuring email alerts on events related to a transformation run.

Parameters:

destination (str) – Email address where notifications should be sent.

class cognite.client.data_classes.transformations.notifications.TransformationNotificationFilter(
transformation_id: int | None = None,
transformation_external_id: str | None = None,
destination: str | None = None,
)

Bases: CogniteFilter

Parameters:
  • transformation_id (int | None) – Filter by transformation internal numeric ID.

  • transformation_external_id (str | None) – Filter by transformation externalId.

  • destination (str | None) – Filter by notification destination.

class cognite.client.data_classes.transformations.notifications.TransformationNotificationList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[TransformationNotificationWrite, TransformationNotification], InternalIdTransformerMixin

as_write() TransformationNotificationWriteList

Returns this TransformationNotificationList instance

class cognite.client.data_classes.transformations.notifications.TransformationNotificationWrite(
destination: str,
transformation_id: int | None = None,
transformation_external_id: str | None = None,
)

Bases: TransformationNotificationCore

The transformation notification resource allows configuring email alerts on events related to a transformation run. This is the write format of a transformation notification.

Parameters:
  • destination (str) – Email address where notifications should be sent.

  • transformation_id (int | None) – Transformation ID.

  • transformation_external_id (str | None) – Transformation external ID.

as_write() TransformationNotificationWrite

Returns this TransformationNotification instance

class cognite.client.data_classes.transformations.notifications.TransformationNotificationWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationNotificationWrite]

class cognite.client.data_classes.transformations.jobs.TransformationJob(
id: int,
uuid: str,
status: TransformationJobStatus,
transformation_id: int,
transformation_external_id: str,
source_project: str,
destination_project: str,
destination: TransformationDestination,
conflict_mode: Literal['abort', 'delete', 'update', 'upsert'],
query: str,
ignore_null_fields: bool,
created_time: int,
error: str | None = None,
started_time: int | None = None,
finished_time: int | None = None,
last_seen_time: int | None = None,
)

Bases: CogniteResourceWithClientRef

The transformation job resource allows following the status of execution of a transformation run.

Parameters:
  • id (int) – A server-generated ID for the object.

  • uuid (str) – A server-generated UUID for the object.

  • status (TransformationJobStatus) – Status of the job.

  • transformation_id (int) – Server-generated ID of the transformation.

  • transformation_external_id (str) – external ID of the transformation.

  • source_project (str) – Name of the CDF project the data will be read from.

  • destination_project (str) – Name of the CDF project the data will be written to.

  • destination (TransformationDestination) – No description.

  • conflict_mode (Literal['abort', 'delete', 'update', 'upsert']) – What to do in case of id collisions: either “abort”, “upsert”, “update” or “delete”.

  • query (str) – Query of the transformation that is being executed.

  • ignore_null_fields (bool) – Indicates how null values are handled on updates: ignore or set null.

  • created_time (int) – Time when the job was created.

  • error (str | None) – Error message from the server.

  • started_time (int | None) – Time when the job started running.

  • finished_time (int | None) – Time when the job finished running.

  • last_seen_time (int | None) – Time of the last status update from the job.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

metrics() TransformationJobMetricList

Get job metrics.

async metrics_async() TransformationJobMetricList

Get job metrics.

update() None

Get updated job status.

async update_async() None

Get updated job status.

wait(
polling_interval: float = 5,
timeout: float | None = None,
) TransformationJob

Waits for the job to finish.

Parameters:
  • polling_interval (float) – time (s) to wait between job status updates, default is one second.

  • timeout (float | None) – maximum time (s) to wait, default is None (infinite time). Once the timeout is reached, it returns with the current status.

Returns:

The transformation job (itself).

Return type:

TransformationJob

Examples

Run transformations 1 and 2 in parallel, and run 3 once they finish successfully:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>>
>>> job1 = client.transformations.run(id=1, wait=False)
>>> job2 = client.transformations.run(id=2, wait=False)
>>> job1.wait()
>>> job2.wait()
>>> if TransformationJobStatus.FAILED not in [job1.status, job2.status]:
>>>     client.transformations.run(id = 3, wait = False)

Wait on transformation for 5 minutes and do something if still running:

>>>
>>> job = client.transformations.run(id=1, wait=False)
>>> job.wait(timeout=5.0 * 60)
>>> match job.status:
>>>     case TransformationJobStatus.FAILED:
>>> # do something if job failed
>>>     case TransformationJobStatus.COMPLETED:
>>> # do something if job completed successfully
>>>     case _:
>>> # do something if job is still running
async wait_async(
polling_interval: float = 5,
timeout: float | None = None,
) TransformationJob

Waits for the job to finish.

Parameters:
  • polling_interval (float) – time (s) to wait between job status updates, default is one second.

  • timeout (float | None) – maximum time (s) to wait, default is None (infinite time). Once the timeout is reached, it returns with the current status.

Returns:

The transformation job (itself).

Return type:

TransformationJob

Examples

Run transformations 1 and 2 in parallel, and run 3 once they finish successfully:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>>
>>> job1 = client.transformations.run(id=1, wait=False)
>>> job2 = client.transformations.run(id=2, wait=False)
>>> job1.wait()
>>> job2.wait()
>>> if TransformationJobStatus.FAILED not in [job1.status, job2.status]:
>>>     client.transformations.run(id = 3, wait = False)

Wait on transformation for 5 minutes and do something if still running:

>>>
>>> job = client.transformations.run(id=1, wait=False)
>>> job.wait(timeout=5.0 * 60)
>>> match job.status:
>>>     case TransformationJobStatus.FAILED:
>>> # do something if job failed
>>>     case TransformationJobStatus.COMPLETED:
>>> # do something if job completed successfully
>>>     case _:
>>> # do something if job is still running
class cognite.client.data_classes.transformations.jobs.TransformationJobFilter(
transformation_id: int | None = None,
transformation_external_id: str | None = None,
)

Bases: CogniteFilter

Parameters:
  • transformation_id (int | None) – Filter jobs by transformation internal numeric ID.

  • transformation_external_id (str | None) – Filter jobs by transformation external ID.

class cognite.client.data_classes.transformations.jobs.TransformationJobList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationJob], InternalIdTransformerMixin

class cognite.client.data_classes.transformations.jobs.TransformationJobMetric(timestamp: int, name: str, count: int)

Bases: CogniteResource

The transformation job metric resource allows following details of execution of a transformation run.

Parameters:
  • timestamp (int) – Time of the last metric update.

  • name (str) – Name of the metric.

  • count (int) – Value of the metric.

class cognite.client.data_classes.transformations.jobs.TransformationJobMetricList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationJobMetric], InternalIdTransformerMixin

class cognite.client.data_classes.transformations.jobs.TransformationJobStatus(value)

Bases: str, Enum

An enumeration.

class cognite.client.data_classes.transformations.schema.TransformationSchemaArrayType(
type: str,
contains_null: bool,
element_type: str | None = None,
)

Bases: TransformationSchemaType

class cognite.client.data_classes.transformations.schema.TransformationSchemaColumn(
name: str,
sql_type: str,
type: TransformationSchemaType,
nullable: bool,
)

Bases: CogniteResource

Represents a column of the expected sql structure for a destination type.

Parameters:
  • name (str) – Column name

  • sql_type (str) – Type of the column in sql format.

  • type (TransformationSchemaType) – Type of the column in json format.

  • nullable (bool) – Values for the column can be null or not

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.schema.TransformationSchemaColumnList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[TransformationSchemaColumn]

class cognite.client.data_classes.transformations.schema.TransformationSchemaMapType(
type: str,
key_type: str | None = None,
value_type: str | None = None,
value_contains_null: bool = False,
)

Bases: TransformationSchemaType

class cognite.client.data_classes.transformations.schema.TransformationSchemaStructType(
type: str,
fields: list[dict[str, Any]] | None = None,
)

Bases: TransformationSchemaType

dump(camel_case: bool = True) dict

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.schema.TransformationSchemaType(type: str)

Bases: CogniteResource

class cognite.client.data_classes.transformations.schema.TransformationSchemaUnknownType(raw_schema: dict[str, Any])

Bases: TransformationSchemaType

dump(
camel_case: Literal[True] = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.common.DataModelInfo(
space: str,
external_id: str,
version: str,
destination_type: str,
destination_relationship_from_type: str | None = None,
)

Bases: CogniteResource

class cognite.client.data_classes.transformations.common.EdgeType(space: str, external_id: str)

Bases: CogniteResource

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.transformations.common.Edges(
view: ViewInfo | None,
instance_space: str | None,
edge_type: EdgeType | None,
)

Bases: TransformationDestination

class cognite.client.data_classes.transformations.common.Instances(
data_model: DataModelInfo | None = None,
instance_space: str | None = None,
)

Bases: TransformationDestination

class cognite.client.data_classes.transformations.common.Nodes(
view: ViewInfo | None,
instance_space: str | None,
)

Bases: TransformationDestination

class cognite.client.data_classes.transformations.common.OidcCredentials(
client_id: str,
client_secret: str,
token_uri: str,
cdf_project_name: str,
scopes: str | list[str] | None = None,
audience: str | None = None,
)

Bases: object

Class that represents OpenID Connect (OIDC) credentials used to authenticate towards Cognite Data Fusion (CDF).

Note

Is currently only used to specify inputs to TransformationsAPI like source_oidc_credentials and destination_oidc_credentials.

Parameters:
  • client_id (str) – Your application’s client id.

  • client_secret (str) – Your application’s client secret

  • token_uri (str) – OAuth token url

  • cdf_project_name (str) – Name of CDF project

  • scopes (str | list[str] | None) – A list of scopes or a comma-separated string (for backwards compatibility).

  • audience (str | None) – Audience (optional)

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

classmethod load(data: dict[str, Any]) Self

Load data into the instance.

Parameters:

data (dict[str, Any]) – A dictionary representation of the instance.

Returns:

No description.

Return type:

Self

class cognite.client.data_classes.transformations.common.RawTable(database: str, table: str)

Bases: TransformationDestination

class cognite.client.data_classes.transformations.common.SequenceRowsDestination(external_id: str)

Bases: TransformationDestination

class cognite.client.data_classes.transformations.common.TransformationBlockedInfo(reason: str, created_time: int)

Bases: object

Information about the reason why and when a transformation is blocked.

Parameters:
  • reason (str) – Reason why the transformation is blocked.

  • created_time (int) – Timestamp when the transformation was blocked.

class cognite.client.data_classes.transformations.common.TransformationDestination(type: str)

Bases: CogniteResource

TransformationDestination has static methods to define the target resource type of a transformation

Parameters:

type (str) – Used as data type identifier on transformation creation/retrieval.

static asset_hierarchy() TransformationDestination

To be used when the transformation is meant to produce asset hierarchies.

static assets() TransformationDestination

To be used when the transformation is meant to produce assets.

static data_sets() TransformationDestination

To be used when the transformation is meant to produce data sets.

static datapoints() TransformationDestination

To be used when the transformation is meant to produce numeric data points.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

static edges(
view: ViewInfo | None = None,
instance_space: str | None = None,
edge_type: EdgeType | None = None,
) Edges
Parameters:
  • view (ViewInfo | None) – information of the view.

  • instance_space (str | None) – space id of the instance.

  • edge_type (EdgeType | None) – information about the type of the edge

Returns:

pointing to the target flexible data model.

Return type:

Edges

static events() TransformationDestination

To be used when the transformation is meant to produce events.

static files() TransformationDestination

To be used when the transformation is meant to produce files.

static instances(
data_model: DataModelInfo | None = None,
instance_space: str | None = None,
) Instances
Parameters:
  • data_model (DataModelInfo | None) – information of the Data Model.

  • instance_space (str | None) – space id of the instance.

Returns:

pointing to the target centric data model.

Return type:

Instances

static labels() TransformationDestination

To be used when the transformation is meant to produce labels.

static nodes(
view: ViewInfo | None = None,
instance_space: str | None = None,
) Nodes
Parameters:
  • view (ViewInfo | None) – information of the view.

  • instance_space (str | None) – space id of the instance.

Returns:

pointing to the target flexible data model.

Return type:

Nodes

static raw(
database: str = '',
table: str = '',
) RawTable

To be used when the transformation is meant to produce raw table rows.

Parameters:
  • database (str) – database name of the target raw table.

  • table (str) – name of the target raw table

Returns:

TransformationDestination pointing to the target table

Return type:

RawTable

static relationships() TransformationDestination

To be used when the transformation is meant to produce relationships.

static sequence_rows(
external_id: str = '',
) SequenceRowsDestination

To be used when the transformation is meant to produce sequence rows.

Parameters:

external_id (str) – Sequence external id.

Returns:

TransformationDestination pointing to the target sequence rows

Return type:

SequenceRowsDestination

static sequences() TransformationDestination

To be used when the transformation is meant to produce sequences.

static string_datapoints() TransformationDestination

To be used when the transformation is meant to produce string data points.

static timeseries() TransformationDestination

To be used when the transformation is meant to produce time series.

class cognite.client.data_classes.transformations.common.ViewInfo(space: str, external_id: str, version: str)

Bases: CogniteResource