Transformations
TransformationsAPI
Create transformations
- async TransformationsAPI.create(
- transformation: Transformation | TransformationWrite | Sequence[Transformation] | Sequence[TransformationWrite],
Create one or more transformations.
- Parameters:
transformation (Transformation | TransformationWrite | Sequence[Transformation] | Sequence[TransformationWrite]) – Transformation or list of transformations to create.
- Returns:
Created transformation(s)
- Return type:
Examples
Create new transformations:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import TransformationWrite, TransformationDestination >>> from cognite.client.data_classes.transformations.common import ViewInfo, EdgeType, DataModelInfo >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformations = [ >>> TransformationWrite( >>> external_id="transformation1", >>> name="transformation1", >>> ignore_null_fields=False, >>> destination=TransformationDestination.assets() >>> ), >>> TransformationWrite( >>> external_id="transformation2", >>> name="transformation2", >>> ignore_null_fields=False, >>> destination=TransformationDestination.raw("myDatabase", "myTable") >>> ), >>> TransformationWrite( >>> external_id="transformation3", >>> name="transformation3", >>> ignore_null_fields=False, >>> view = ViewInfo(space="TypeSpace", external_id="TypeExtId", version="version"), >>> destination=TransformationDestination.nodes(view, "InstanceSpace") >>> ), >>> TransformationWrite( >>> external_id="transformation4", >>> name="transformation4", >>> ignore_null_fields=False, >>> view = ViewInfo(space="TypeSpace", external_id="TypeExtId", version="version"), >>> destination=TransformationDestination.edges(view, "InstanceSpace") >>> ), >>> TransformationWrite( >>> external_id="transformation5", >>> name="transformation5", >>> ignore_null_fields=False, >>> edge_type = EdgeType(space="TypeSpace", external_id="TypeExtId"), >>> destination=TransformationDestination.edges(edge_type,"InstanceSpace") >>> ), >>> TransformationWrite( >>> external_id="transformation6", >>> name="transformation6", >>> ignore_null_fields=False, >>> data_model = DataModelInfo(space="modelSpace", external_id="modelExternalId",version="modelVersion",destination_type="viewExternalId"), >>> destination=TransformationDestination.instances(data_model,"InstanceSpace") >>> ), >>> TransformationWrite( >>> external_id="transformation7", >>> name="transformation7", >>> ignore_null_fields=False, >>> data_model = DataModelInfo(space="modelSpace", external_id="modelExternalId",version="modelVersion",destination_type="viewExternalId", destination_relationship_from_type="connectionPropertyName"), >>> destination=TransformationDestination.instances(data_model,"InstanceSpace") >>> ), >>> ] >>> res = client.transformations.create(transformations)
Retrieve transformations by id
- async TransformationsAPI.retrieve(
- id: int | None = None,
- external_id: str | None = None,
Retrieve a single transformation by id.
- Parameters:
id (int | None) – ID
external_id (str | None) – No description.
- Returns:
Requested transformation or None if it does not exist.
- Return type:
Transformation | None
Examples
Get transformation by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.retrieve(id=1)
Get transformation by external id:
>>> res = client.transformations.retrieve(external_id="1")
- async TransformationsAPI.retrieve_multiple(
- ids: Sequence[int] | None = None,
- external_ids: SequenceNotStr[str] | None = None,
- ignore_unknown_ids: bool = False,
Retrieve multiple transformations.
- Parameters:
ids (Sequence[int] | None) – List of ids to retrieve.
external_ids (SequenceNotStr[str] | None) – List of external ids to retrieve.
ignore_unknown_ids (bool) – Ignore IDs and external IDs that are not found rather than throw an exception.
- Returns:
Requested transformation or None if it does not exist.
- Return type:
Examples
Get multiple transformations:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.retrieve_multiple(ids=[1,2,3], external_ids=['transform-1','transform-2'])
Run transformations by id
- async TransformationsAPI.run(
- transformation_id: int | None = None,
- transformation_external_id: str | None = None,
- wait: bool = True,
- timeout: float | None = None,
-
- Parameters:
transformation_id (int | None) – Transformation internal id
transformation_external_id (str | None) – Transformation external id
wait (bool) – Wait until the transformation run is finished. Defaults to True.
timeout (float | None) – maximum time (s) to wait, default is None (infinite time). Once the timeout is reached, it returns with the current status. Won’t have any effect if wait is False.
- Returns:
Created transformation job
- Return type:
Examples
Run transformation to completion by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> >>> res = client.transformations.run(transformation_id=1)
Start running transformation by id:
>>> res = client.transformations.run(transformation_id=1, wait=False)
Preview transformations
- async TransformationsAPI.preview(
- query: str | None = None,
- convert_to_string: bool = False,
- limit: int | None = 100,
- source_limit: int | None = 100,
- infer_schema_limit: int | None = 10000,
- timeout: int | None = 240,
Preview the result of a query.
- Parameters:
query (str | None) – SQL query to run for preview.
convert_to_string (bool) – Stringify values in the query results, default is False.
limit (int | None) – Maximum number of rows to return in the final result, default is 100.
source_limit (int | None) – Maximum number of items to read from the data source or None to run without limit, default is 100.
infer_schema_limit (int | None) – Limit for how many rows that are used for inferring result schema, default is 10 000.
timeout (int | None) – Number of seconds to wait before cancelling a query. The default, and maximum, is 240.
- Returns:
Result of the executed query
- Return type:
Examples
Preview transformation results as schema and list of rows:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> >>> query_result = client.transformations.preview(query="select * from _cdf.assets")
Preview transformation results as pandas dataframe:
>>> df = client.transformations.preview(query="select * from _cdf.assets").to_pandas()
Notice that the results are limited both by the limit and source_limit parameters. If you have a query that converts one source row to one result row, you may need to increase the source_limit. For example, given that you have a query that reads from a raw table with 10,903 rows
>>> result = client.transformations.preview(query="select * from my_raw_db.my_raw_table", limit=None) >>> print(result.results) # 100
To get all rows, you also need to set the source_limit to None:
>>> result = client.transformations.preview(query="select * from my_raw_db.my_raw_table", limit=None, source_limit=None) >>> print(result.results) # 10903
Cancel transformation run by id
- async TransformationsAPI.cancel(
- transformation_id: int | None = None,
- transformation_external_id: str | None = None,
Cancel a running transformation.
- Parameters:
transformation_id (int | None) – Transformation internal id
transformation_external_id (str | None) – Transformation external id
Examples
Wait transformation for 1 minute and cancel if still running:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import TransformationJobStatus >>> client = CogniteClient() >>> >>> res = client.transformations.run(transformation_id=1, timeout=60.0) >>> if res.status == TransformationJobStatus.RUNNING: >>> res.cancel()
List transformations
- async TransformationsAPI.list(
- include_public: bool = True,
- name_regex: str | None = None,
- query_regex: str | None = None,
- destination_type: str | None = None,
- conflict_mode: str | 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: int | list[int] | None = None,
- data_set_external_ids: str | list[str] | None = None,
- tags: TagsFilter | None = None,
- limit: int | None = 25,
-
- Parameters:
include_public (bool) – Whether public transformations should be included in the results. (default 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 (str | None) – Filters by a selected transformation action type: abort/create, 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 (int | list[int] | None) – Return only transformations in the specified data sets with these id(s).
data_set_external_ids (str | list[str] | None) – Return only transformations in the specified data sets with these external id(s).
tags (TagsFilter | None) – Return only the resource matching the specified tags constraints. It only supports ContainsAny as of now.
limit (int | None) – Limits the number of results to be returned. To retrieve all results use limit=-1, default limit is 25.
- Returns:
List of transformations
- Return type:
Example
List transformations:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformations_list = client.transformations.list()
Update transformations
- async TransformationsAPI.update(
- item: Transformation | TransformationWrite | TransformationUpdate | Sequence[Transformation | TransformationWrite | TransformationUpdate],
- mode: Literal['replace_ignore_null', 'patch', 'replace'] = 'replace_ignore_null',
Update one or more transformations
- Parameters:
item (Transformation | TransformationWrite | TransformationUpdate | Sequence[Transformation | TransformationWrite | TransformationUpdate]) – Transformation(s) to update
mode (Literal['replace_ignore_null', 'patch', 'replace']) – How to update data when a non-update object is given (Transformation or -Write). If you use ‘replace_ignore_null’, only the fields you have set will be used to replace existing (default). Using ‘replace’ will additionally clear all the fields that are not specified by you. Last option, ‘patch’, will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see Update and Upsert Mode Parameter.
- Returns:
Updated transformation(s)
- Return type:
Examples
Update a transformation that you have fetched. This will perform a full update of the transformation:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformation = client.transformations.retrieve(id=1) >>> transformation.query = "SELECT * FROM _cdf.assets" >>> res = client.transformations.update(transformation)
Perform a partial update on a transformation, updating the query and making it private:
>>> from cognite.client.data_classes import TransformationUpdate >>> my_update = TransformationUpdate(id=1).query.set("SELECT * FROM _cdf.assets").is_public.set(False) >>> res = client.transformations.update(my_update)
Update the session used for reading (source) and writing (destination) when authenticating for all transformations in a given data set:
>>> from cognite.client.data_classes import NonceCredentials >>> to_update = client.transformations.list(data_set_external_ids=["foo"]) >>> new_session = client.iam.sessions.create() >>> new_nonce = NonceCredentials( ... session_id=new_session.id, ... nonce=new_session.nonce, ... cdf_project_name=client.config.project ... ) >>> for tr in to_update: ... tr.source_nonce = new_nonce ... tr.destination_nonce = new_nonce >>> res = client.transformations.update(to_update)
Delete transformations
- async TransformationsAPI.delete(
- id: int | Sequence[int] | None = None,
- external_id: str | SequenceNotStr[str] | None = None,
- ignore_unknown_ids: bool = False,
Delete one or more transformations.
- Parameters:
id (int | Sequence[int] | None) – Id or list of ids.
external_id (str | SequenceNotStr[str] | None) – External ID or list of external ids.
ignore_unknown_ids (bool) – Ignore IDs and external IDs that are not found rather than throw an exception.
Example
Delete transformations by id or external id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> client.transformations.delete(id=[1,2,3], external_id="function3")
Transformation Schedules
Create transformation Schedules
- async TransformationSchedulesAPI.create(
- schedule: TransformationSchedule | TransformationScheduleWrite | Sequence[TransformationSchedule] | Sequence[TransformationScheduleWrite],
Schedule the specified transformation with the specified configuration(s).
- Parameters:
schedule (TransformationSchedule | TransformationScheduleWrite | Sequence[TransformationSchedule] | Sequence[TransformationScheduleWrite]) – Configuration or list of configurations of the schedules to create.
- Returns:
Created schedule(s)
- Return type:
Examples
Create new schedules:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import TransformationScheduleWrite >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> schedules = [TransformationScheduleWrite(id = 1, interval = "0 * * * *"), TransformationScheduleWrite(external_id="transformation2", interval = "5 * * * *"))] >>> res = client.transformations.schedules.create(schedules)
Retrieve transformation schedules
- async TransformationSchedulesAPI.retrieve(
- id: int | None = None,
- external_id: str | None = None,
Retrieve a single transformation schedule by the id or external id of its transformation.
- Parameters:
id (int | None) – transformation ID
external_id (str | None) – transformation External ID
- Returns:
Requested transformation schedule or None if it does not exist.
- Return type:
TransformationSchedule | None
Examples
Get transformation schedule by transformation id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.schedules.retrieve(id=1)
Get transformation schedule by transformation external id:
>>> res = client.transformations.schedules.retrieve(external_id="1")
Retrieve multiple transformation schedules
- async TransformationSchedulesAPI.retrieve_multiple(
- ids: Sequence[int] | None = None,
- external_ids: SequenceNotStr[str] | None = None,
- ignore_unknown_ids: bool = False,
-
- Parameters:
ids (Sequence[int] | None) – transformation IDs
external_ids (SequenceNotStr[str] | None) – transformation External IDs
ignore_unknown_ids (bool) – Ignore IDs and external IDs that are not found rather than throw an exception.
- Returns:
Requested transformation schedules.
- Return type:
Examples
Get transformation schedules by transformation ids:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.schedules.retrieve_multiple(ids=[1, 2, 3])
Get transformation schedules by transformation external ids:
>>> res = client.transformations.schedules.retrieve_multiple(external_ids=["t1", "t2"])
List transformation schedules
- async TransformationSchedulesAPI.list(
- include_public: bool = True,
- limit: int | None = 25,
List all transformation schedules.
- Parameters:
include_public (bool) – Whether public transformations should be included in the results. (default true).
limit (int | None) – Limits the number of results to be returned. To retrieve all results use limit=-1, default limit is 25.
- Returns:
List of schedules
- Return type:
Example
List schedules:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> schedules_list = client.transformations.schedules.list()
Update transformation schedules
- async TransformationSchedulesAPI.update(
- item: TransformationSchedule | TransformationScheduleWrite | TransformationScheduleUpdate | Sequence[TransformationSchedule | TransformationScheduleWrite | TransformationScheduleUpdate],
- mode: Literal['replace_ignore_null', 'patch', 'replace'] = 'replace_ignore_null',
Update one or more transformation schedules
- Parameters:
item (TransformationSchedule | TransformationScheduleWrite | TransformationScheduleUpdate | Sequence[TransformationSchedule | TransformationScheduleWrite | TransformationScheduleUpdate]) – Transformation schedule(s) to update
mode (Literal['replace_ignore_null', 'patch', 'replace']) – How to update data when a non-update object is given (TransformationSchedule or -Write). If you use ‘replace_ignore_null’, only the fields you have set will be used to replace existing (default). Using ‘replace’ will additionally clear all the fields that are not specified by you. Last option, ‘patch’, will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see Update and Upsert Mode Parameter.
- Returns:
Updated transformation schedule(s)
- Return type:
Examples
Update a transformation schedule that you have fetched. This will perform a full update of the schedule:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformation_schedule = client.transformations.schedules.retrieve(id=1) >>> transformation_schedule.is_paused = True >>> res = client.transformations.schedules.update(transformation_schedule)
Perform a partial update on a transformation schedule, updating the interval and unpausing it:
>>> from cognite.client.data_classes import TransformationScheduleUpdate >>> my_update = TransformationScheduleUpdate(id=1).interval.set("0 * * * *").is_paused.set(False) >>> res = client.transformations.schedules.update(my_update)
Delete transformation schedules
- async TransformationSchedulesAPI.delete(
- id: int | Sequence[int] | None = None,
- external_id: str | SequenceNotStr[str] | None = None,
- ignore_unknown_ids: bool = False,
Unschedule one or more transformations
- Parameters:
id (int | Sequence[int] | None) – Id or list of ids
external_id (str | SequenceNotStr[str] | None) – External ID or list of external ids
ignore_unknown_ids (bool) – Ignore IDs and external IDs that are not found rather than throw an exception.
Examples
Delete schedules by id or external id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> client.transformations.schedules.delete(id=[1,2,3], external_id="3")
Transformation Notifications
Create transformation notifications
- async TransformationNotificationsAPI.create(
- notification: TransformationNotification | TransformationNotificationWrite | Sequence[TransformationNotification] | Sequence[TransformationNotificationWrite],
Subscribe for notifications on the transformation errors.
- Parameters:
notification (TransformationNotification | TransformationNotificationWrite | Sequence[TransformationNotification] | Sequence[TransformationNotificationWrite]) – Notification or list of notifications to create.
- Returns:
Created notification(s)
- Return type:
Examples
Create new notifications:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import TransformationNotification >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> notifications = [TransformationNotification(transformation_id = 1, destination="my@email.com"), TransformationNotification(transformation_external_id="transformation2", destination="other@email.com"))] >>> res = client.transformations.notifications.create(notifications)
List transformation notifications
- async TransformationNotificationsAPI.list(
- transformation_id: int | None = None,
- transformation_external_id: str | None = None,
- destination: str | None = None,
- limit: int | None = 25,
List notification subscriptions.
- 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.
limit (int | None) – Limits the number of results to be returned. To retrieve all results use limit=-1, default limit is 25.
- Returns:
List of transformation notifications
- Return type:
Example
List all notifications:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> notifications_list = client.transformations.notifications.list()
List all notifications by transformation id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> notifications_list = client.transformations.notifications.list(transformation_id = 1)
Delete transformation notifications
- async TransformationNotificationsAPI.delete(
- id: int | Sequence[int] | None = None,
-
- Parameters:
id (int | Sequence[int] | None) – Id or list of transformation notification ids
Examples
Delete schedules by id or external id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> client.transformations.notifications.delete(id=[1,2,3])
Transformation Jobs
Retrieve transformation jobs
- async TransformationJobsAPI.retrieve(
- id: int,
Retrieve a single transformation job by id.
- Parameters:
id (int) – Job internal Id
- Returns:
Requested transformation job or None if it does not exist.
- Return type:
TransformationJob | None
Examples
Get transformation job by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.jobs.retrieve(id=1)
- async TransformationJobsAPI.retrieve_multiple(
- ids: Sequence[int],
- ignore_unknown_ids: bool = False,
Retrieve multiple transformation jobs by id.
- Parameters:
ids (Sequence[int]) – Job internal Ids
ignore_unknown_ids (bool) – Ignore IDs that are not found rather than throw an exception.
- Returns:
Requested transformation jobs.
- Return type:
Examples
Get jobs by id:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> res = client.transformations.jobs.retrieve_multiple(ids=[1, 2, 3])
List transformation jobs
- async TransformationJobsAPI.list(
- limit: int | None = 25,
- transformation_id: int | None = None,
- transformation_external_id: str | None = None,
List all running transformation jobs.
- Parameters:
limit (int | None) – Limits the number of results to be returned. To retrieve all results use limit=-1, default limit is 25.
transformation_id (int | None) – Filters the results by the internal transformation id.
transformation_external_id (str | None) – Filters the results by the external transformation id.
- Returns:
List of transformation jobs
- Return type:
Example
List transformation jobs:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformation_jobs_list = client.transformations.jobs.list()
List transformation jobs of a single transformation:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> transformation_jobs_list = client.transformations.jobs.list(transformation_id=1)
Transformation Schema
Get transformation schema
- async TransformationSchemaAPI.retrieve(
- destination: TransformationDestination,
- conflict_mode: str | None = None,
Get expected schema for a transformation destination.
- Parameters:
destination (TransformationDestination) – destination for which the schema is requested.
conflict_mode (str | None) – conflict mode for which the schema is requested.
- Returns:
List of column descriptions
- Return type:
Example
Get the schema for a transformation producing assets:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import TransformationDestination >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> columns = client.transformations.schema.retrieve(destination = TransformationDestination.assets())
Data classes
- class cognite.client.data_classes.transformations.ContainsAny(tags: list[str] | None = None)
Bases:
TagsFilterReturn 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:
objectDetails 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: str,
- is_public: bool,
- ignore_null_fields: bool,
- source_oidc_credentials: OidcCredentials | None,
- destination_oidc_credentials: OidcCredentials | None,
- created_time: int,
- last_updated_time: int,
- owner: str,
- owner_is_current_user: bool,
- running_job: TransformationJob | None,
- last_finished_job: TransformationJob | None,
- blocked: TransformationBlockedInfo | None,
- schedule: TransformationSchedule | None,
- data_set_id: int | None,
- source_nonce: NonceCredentials | None,
- destination_nonce: NonceCredentials | None,
- source_session: SessionDetails | None,
- destination_session: SessionDetails | None,
- tags: list[str] | None = None,
Bases:
WriteableCogniteResourceWithClientRef[TransformationWrite],_TransformationsCredentialsMixinThe 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 (str) – 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.
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.
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.
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,
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:
- async run_async(
- wait: bool = True,
- timeout: float | None = None,
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:
- 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: str | 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:
CogniteFilterNo 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 (str | None) – Filters by a selected transformation action type: abort/create, 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:
CogniteResourceAllows 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,
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:
CogniteUpdateChanges 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],_TransformationsCredentialsMixinThe 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:
TransformationScheduleCoreThe 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 | None, is_paused: bool)
Bases:
WriteableCogniteResource[TransformationScheduleWrite],ABCThe transformation schedules resource allows running recurrent transformations.
- Parameters:
interval (str | None) – 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:
CogniteUpdateChanges 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:
TransformationScheduleCoreThe 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:
TransformationNotificationCoreThe 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],ABCThe 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:
TransformationNotificationCoreThe 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],
- class cognite.client.data_classes.transformations.jobs.TransformationJob(
- id: int,
- status: TransformationJobStatus,
- transformation_id: int,
- transformation_external_id: str,
- source_project: str,
- destination_project: str,
- destination: TransformationDestination,
- conflict_mode: str,
- query: str,
- error: str | None,
- ignore_null_fields: bool,
- created_time: int | None,
- started_time: int | None,
- finished_time: int | None,
- last_seen_time: int | None,
Bases:
CogniteResourceWithClientRefThe transformation job resource allows following the status of execution of a transformation run.
- Parameters:
id (int) – A server-generated ID 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 (str) – What to do in case of id collisions: either “abort”, “upsert”, “update” or “delete”.
query (str) – Query of the transformation that is being executed.
error (str | None) – Error message from the server.
ignore_null_fields (bool) – Indicates how null values are handled on updates: ignore or set null.
created_time (int | None) – Time when the job was created.
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,
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:
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,
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:
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:
CogniteResourceThe 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,EnumAn enumeration.
- class cognite.client.data_classes.transformations.schema.TransformationSchemaArrayType(
- type: str,
- element_type: str | None,
- contains_null: bool,
Bases:
TransformationSchemaType
- class cognite.client.data_classes.transformations.schema.TransformationSchemaColumn(
- name: str,
- sql_type: str,
- type: TransformationSchemaType,
- nullable: bool,
Bases:
CogniteResourceRepresents 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,
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],
- 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,
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,
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( )
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:
objectClass 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:
objectInformation 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:
CogniteResourceTransformationDestination 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,
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 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,
- 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:
- static labels() TransformationDestination
To be used when the transformation is meant to produce labels.
- static raw(
- database: str = '',
- table: str = '',
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:
- static relationships() TransformationDestination
To be used when the transformation is meant to produce relationships.
- static sequence_rows(
- external_id: str = '',
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:
- 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