[BUG] system.tag.queryTagHistory error when startDate before first sample


I’m trying to execute the system.tag.queryTagHistory for a tag over a general time period (2 years) as I don’t know exactly when it was first put into commission, however running it I get this error:

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Invalid object name 'sqlt_data_1_2018_01'.

I realise the reason for the error is due to no history having been captured for any tags in Jan 2018, however I feel that this should not be returned as an exception error, but rather should just be ignored and moved onto the next period table. Imo, the time period shouldn’t be expected to be valid in terms of it having data. When we get the data back, we will know there is starting (or ending) data missing, but it shouldn’t be up to us to first confirm if there is data available for particular time periods before executing this function.

Pretty sure that means someone deleted that table, but it still exists in the historian meta-data.

1 Like

Check sqlth_partitions, and remove any references to outdated tables. This is a wrinkle with manual DB maintenance, and why pruning is the ‘preferred’ solution.