Class CogniteDestinationWithIDM
Class with utility methods supporting extraction of data into CDF. These methods complement the ones offered by the CogniteSdk.Client and use a CogniteConfig object to determine chunking of data and throttling of requests against the client
Implements
Inherited Members
Namespace: Cognite.Extractor.Utils
Assembly: ExtractorUtils.dll
Syntax
public class CogniteDestinationWithIDM : CogniteDestination, IRawDestination
Constructors
| Edit this page View SourceCogniteDestinationWithIDM(Client, ILogger<CogniteDestination>, CogniteConfig, ViewIdentifier?)
Initializes the Cognite destination with the provided parameters
Declaration
public CogniteDestinationWithIDM(Client client, ILogger<CogniteDestination> logger, CogniteConfig config, ViewIdentifier? viewIdentifier = null)
Parameters
Type | Name | Description |
---|---|---|
Client | client | CogniteSdk.Client object |
ILogger<CogniteDestination> | logger | Logger |
CogniteConfig | config | Configuration object |
ViewIdentifier | viewIdentifier | Optional view identifier |
Properties
| Edit this page View SourceIDMViewIdentifier
View identifier for IDM TimeSeries
Declaration
public static ViewIdentifier IDMViewIdentifier { get; protected set; }
Property Value
Type | Description |
---|---|
ViewIdentifier |
Methods
| Edit this page View SourceEnsureTimeSeriesExistsAsync<T>(IEnumerable<SourcedNodeWrite<T>>, RetryMode, SanitationMode, CancellationToken)
Ensures that all time series in timeSeries
exist in CDF.
Tries to create the time series and returns when all are created or have been removed
due to issues with the request.
By default, if any items fail to be created due to missing asset, duplicated externalId, duplicated
legacy name, or missing dataSetId, they can be removed before retrying by setting
retryMode
Timeseries will be returned in the same order as given in timeSeries
Declaration
public Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> EnsureTimeSeriesExistsAsync<T>(IEnumerable<SourcedNodeWrite<T>> timeSeries, RetryMode retryMode, SanitationMode sanitationMode, CancellationToken token) where T : CogniteExtractorTimeSeries
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SourcedNodeWrite<T>> | timeSeries | List of CogniteSdk TimeSeries objects |
RetryMode | retryMode | How to do retries. Keeping duplicates is not valid for this method. |
SanitationMode | sanitationMode | The type of sanitation to apply to timeseries before creating |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> | A CogniteResult<TResult, TError> containing errors that occured and a list of the created timeseries |
Type Parameters
Name | Description |
---|---|
T |
GetOrCreateTimeSeriesAsync<T>(IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>>, RetryMode, SanitationMode, CancellationToken)
Ensures the the time series with the provided instanceIds
exist in CDF.
If one or more do not exist, use the buildTimeSeries
function to construct
the missing time series objects and upload them to CDF.
This method uses the CogniteConfig object to determine chunking of items and throttling
against CDF
If any items fail to be created due to missing asset, duplicated externalId, duplicated
legacy name, or missing dataSetId, they can be removed before retrying by setting
retryMode
Declaration
public Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> GetOrCreateTimeSeriesAsync<T>(IEnumerable<InstanceIdentifier> instanceIds, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>> buildTimeSeries, RetryMode retryMode, SanitationMode sanitationMode, CancellationToken token) where T : CogniteExtractorTimeSeries
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<InstanceIdentifier> | instanceIds | Instance Ids |
Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>> | buildTimeSeries | Function that builds CogniteSdk TimeSeries objects |
RetryMode | retryMode | How to handle failed requests |
SanitationMode | sanitationMode | The type of sanitation to apply to TimeSeries before creating |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> | A CogniteResult<TResult, TError> containing errors that occurred and a list of the created and found TimeSeries |
Type Parameters
Name | Description |
---|---|
T |
GetOrCreateTimeSeriesAsync<T>(IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, Task<IEnumerable<SourcedNodeWrite<T>>>>, RetryMode, SanitationMode, CancellationToken)
Ensures the the time series with the provided instanceIds
exist in CDF.
If one or more do not exist, use the buildTimeSeries
function to construct
the missing time series objects and upload them to CDF.
This method uses the CogniteConfig object to determine chunking of items and throttling
against CDF
By default, if any items fail to be created due to missing asset, duplicated externalId, duplicated
legacy name, or missing dataSetId, they can be removed before retrying by setting
retryMode
Declaration
public Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> GetOrCreateTimeSeriesAsync<T>(IEnumerable<InstanceIdentifier> instanceIds, Func<IEnumerable<InstanceIdentifier>, Task<IEnumerable<SourcedNodeWrite<T>>>> buildTimeSeries, RetryMode retryMode, SanitationMode sanitationMode, CancellationToken token) where T : CogniteExtractorTimeSeries
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<InstanceIdentifier> | instanceIds | Instance Ids |
Func<IEnumerable<InstanceIdentifier>, Task<IEnumerable<SourcedNodeWrite<T>>>> | buildTimeSeries | Async function that builds CogniteSdk TimeSeries objects |
RetryMode | retryMode | How to handle failed requests |
SanitationMode | sanitationMode | The type of sanitation to apply to TimeSeries before creating |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<CogniteResult<SourcedNode<T>, SourcedNodeWrite<T>>> | A CogniteResult<TResult, TError> containing errors that occured and a list of the created and found TimeSeries |
Type Parameters
Name | Description |
---|---|
T |
GetTimeSeriesByIdsIgnoreErrors<T>(IEnumerable<Identity>, CancellationToken)
Gets TimeSeries by ids in timeSeries
, ignoring errors.
Declaration
public Task<IEnumerable<SourcedNode<T>>> GetTimeSeriesByIdsIgnoreErrors<T>(IEnumerable<Identity> timeSeries, CancellationToken token) where T : CogniteExtractorTimeSeries
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Identity> | timeSeries | List of TimeSeries instance ids to fetch |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<IEnumerable<SourcedNode<T>>> | A CogniteResult<TResult, TError> containing errors that occured and a list of the created timeseries |
Type Parameters
Name | Description |
---|---|
T |
InsertDataPointsCreateMissingAsync(IDictionary<Identity, IEnumerable<Datapoint>>?, SanitationMode, RetryMode, CancellationToken)
Insert datapoints to timeseries. Insertions are chunked and cleaned according to configuration, and can optionally handle errors. If any timeseries missing from the result and inserted by externalId, they are created before the points are inserted again.
Declaration
public Task<(CogniteResult<DataPointInsertError> DataPointResult, CogniteResult<SourcedNode<CogniteTimeSeriesBase>, SourcedNodeWrite<CogniteTimeSeriesBase>>? TimeSeriesResult)> InsertDataPointsCreateMissingAsync(IDictionary<Identity, IEnumerable<Datapoint>>? points, SanitationMode sanitationMode, RetryMode retryMode, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<Identity, IEnumerable<Datapoint>> | points | Datapoints to insert |
SanitationMode | sanitationMode | How to sanitize datapoints |
RetryMode | retryMode | How to handle retries |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<(CogniteResult<DataPointInsertError> DataPointResult, CogniteResult<SourcedNode<CogniteTimeSeriesBase>, SourcedNodeWrite<CogniteTimeSeriesBase>> TimeSeriesResult)> | Results with a list of errors. If TimeSeriesResult is null, no timeseries were attempted created. |
InsertDataPointsIDMAsync(IDictionary<Identity, IEnumerable<Datapoint>>?, SanitationMode, RetryMode, CancellationToken)
Insert the provided data points into CDF. The data points are chunked
according to CdfChunking and trimmed according to the
CDF limits.
The points
dictionary keys are time series identities (Id or ExternalId) and the values are numeric or string data points
On error, the offending timeseries/datapoints can optionally be removed.
Declaration
public Task<CogniteResult<DataPointInsertError>> InsertDataPointsIDMAsync(IDictionary<Identity, IEnumerable<Datapoint>>? points, SanitationMode sanitationMode, RetryMode retryMode, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<Identity, IEnumerable<Datapoint>> | points | Data points |
SanitationMode | sanitationMode | |
RetryMode | retryMode | |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<CogniteResult<DataPointInsertError>> |
UpsertTimeSeriesAsync<T>(IEnumerable<SourcedNodeWrite<T>>, RetryMode, SanitationMode, CancellationToken)
Upsert timeseries in updates
.
If items fail due to duplicated instance ids, they can be removed before retrying
by setting retryMode
.
TimeSeries will be returned in the same order as given.
Declaration
public Task<CogniteResult<SlimInstance, SourcedNodeWrite<T>>> UpsertTimeSeriesAsync<T>(IEnumerable<SourcedNodeWrite<T>> updates, RetryMode retryMode, SanitationMode sanitationMode, CancellationToken token) where T : CogniteExtractorTimeSeries
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SourcedNodeWrite<T>> | updates | List of TimeSeries objects |
RetryMode | retryMode | How to do retries. Keeping duplicates is not valid for this method. |
SanitationMode | sanitationMode | The type of sanitation to apply to assets before updating |
CancellationToken | token | Cancellation token |
Returns
Type | Description |
---|---|
Task<CogniteResult<SlimInstance, SourcedNodeWrite<T>>> | A CogniteResult<TResult, TError> containing errors that occured and a list of the updated TimeSeries |
Type Parameters
Name | Description |
---|---|
T |