Backfill data with a piconfig script
- Last UpdatedMar 08, 2025
- 2 minute read
We recommend using an interface (such as UFL, RDBMS, or RDBMSPI) to backfill data into Data Archive. However, you can also use a piconfig script to backfill data.
-
Create a comma-separated text file containing the data.
Format your text file as follows:
-
One tag value per line.
Each line must include the tag name, time stamp, and value. The time stamp must be in the format that is shown in the following example:
A1HV074B,08-Aug-89 11:00:00,3659
Note: For more information about PI time, see PI time expressions.
-
Values from multiple tags can be included in a single file.
-
Values must be in time order (oldest to newest) for each tag to backfill with compression.
-
-
If you have a large amount of data, separate the data into smaller files so you can easily manage and track the backfilling (for example, one day at a time)
-
Add the following piconfig script to the beginning of the file:
@mode edit,t
@table pisnap
@istr tag, time, value
A1HV074B,08-Aug-89 11:00:00,3659
... [followed by the rest of your data] -
Save the file as a *.csv file, such as data.csv.
-
Test the piconfig script with a small sample of data.
Always run a backfill test with a small amount of data first, and then do the rest of the data. This way you can verify your piconfig script and make sure that the data is importing properly. Check the archive and snapshot statistics during the test to see how the backfilling affects Data Archive performance.
Check the archive and snapshot statistics during the test to see how the backfilling affects Data Archive performance.
-
Force an archive shift to avoid backfilling into a primary archive if you are backfilling on a production system. The easiest way to do this is with the PI SMT Archive Editor plug-in.
-
Open a command prompt window.
-
Change to the PI\adm directory.
-
Run piconfig and redirect your previously prepared data file. Substitute the actual path and file name of your prepared text file for c:\tags\data.csv in the example below:
piconfig < c:\tags\data.csv
-
Verify your data using DataLink.