@gorankarlsen can you try out Cognite PI Replace Utility. It allows you to target a specific date range, optionally delete the "straight-line" gap in CDF, and re-ingest the actual historical data from your PI Server.
Here is a configuration template:
version: 2
cognite:
project: <your-project>
idp-authentication:
tenant: ${COGNITE_TENANT_ID}
client-id: ${COGNITE_CLIENT_ID}
secret: ${COGNITE_CLIENT_SECRET}
scopes:
- ${COGNITE_SCOPE}
time-series:
external-id-prefix: "pi:" # Ensure this matches your PI extractor's prefix
pi:
host: ${PI_HOST}
username: ${PI_USER}
password: ${PI_PASS}
replace:
start-time: "<gap-start-time>"
end-time: "<gap-end-time>"
delete-data-points: true # Deletes the straight-line gap in CDF before re-ingestion
include-tags:
- "<YOUR_TAG_1>"
- "<YOUR_TAG_2>"
Recommended steps:
-
Dry-run first: Add dry-run: true to the replace block and run PiExtractor.exe replace -f <your_config_file>.yml. This will compare PI data with CDF data and log differences without making any changes.
-
Execute: Once you've verified the dry-run output, set dry-run: false (or remove the line) and run the command again to perform the actual replacement.