Rotate Keys
- async AsyncCogniteClient.transformations.external_data_sources.rotate_keys(
- rotation: ExternalDataSourceRotateKeys | Sequence[ExternalDataSourceRotateKeys],
Rotate the keys of Snowflake external data sources.
The server generates a new key pair for each data source and returns the new public key, which you must register with the Snowflake user. Only Snowflake data sources support this. The operation is atomic: if any item fails, no keys are rotated. At most 10 data sources can be rotated per call, with unique external IDs.
- Parameters:
rotation (ExternalDataSourceRotateKeys | Sequence[ExternalDataSourceRotateKeys]) – The rotation(s) to perform. Each
expiry_timemust be in the future and at most one year from now.- Returns:
The new public key and expiry time of each rotated data source.
- Return type:
ExternalDataSourceRotatedKeys | ExternalDataSourceRotatedKeysList
- Raises:
ValueError – If more than 10 rotations are passed.
Examples
Rotate the keys of a Snowflake data source, valid for 30 days:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> from cognite.client.data_classes.transformations.externaldata import ( ... ExternalDataSourceRotateKeys, ... ) >>> from cognite.client.utils._time import timestamp_to_ms >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> expiry_time = timestamp_to_ms("30d-ahead") >>> res = client.transformations.external_data_sources.rotate_keys( ... ExternalDataSourceRotateKeys("snowflake-analytics-prod", expiry_time) ... ) >>> new_public_key = res.public_key