[Feature] Store Tag History with Overwrite

Would it be possible to add an overwrite option to the system.tag.storeTagHistory function?
If I try to move some historical data into a tag that already has history in it, the database queries go into the store and forward quarantine because the primary key (t_stamp and id) of the data is the same as what it is adding. I would like it to clear the history table data for the time period it is transferring in, then bring in the new data.

This would be similar to how the system.tag.configure function has a “m” or “o” option to overwrite the current tag configuration.

1 Like

I have the same problem. The records get quarantined if timestamp is the same. Any of the following methods can solve my problem:

  • Option to overwrite previous record for system.tag.storeTagHistory
  • Option to throw exception, or disable quarantine for system.tag.storeTagHistory
  • Function to remove records from historian by paths and timestamps
  • Function to query historian with a list of tags and a list of timestamps, instead of time range, so I can check if records exist before calling storeTagHistory

Most databases have the ability to add insert triggers that can handle such conflicts any way you like. If you must. Ignition's store and forward system doesn't really have enough information at all times to deal with this kind of garbage in. Ideally, you should figure out what is producing the duplicates and fix that.

Thanks, insert trigger sounds like a good idea to get around the problem. However, most timeseries database has the ability to overwrite past values. I hope ignition can support it natively.

Ignition isn't a time-series database. It delegates to generic databases, some of which can do this sort of thing for you.