Query from most recent partitionTag Historian Database

I am querying the most recent partition table ([sqlt_data_1_2023_07]) from Tag Historian database. I plan to run this query programmatically but not sure how to keep track of the most recent partition. If data starts getting saved in _08 partition in the future then this code will break at that time. Any suggestions on how to find the latest partition?

The architecture of Ignition's historian tables is documented here:

https://docs.inductiveautomation.com/display/DOC81/Ignition+Database+Table+Reference

But, you should not be accessing these tables yourself. The Right Answer™ is to use the provided system.tag.query* scripting functions and let Ignition manage its partitions however it wants. This protects you from breaking changes in the future.

1 Like

Thank you. I actually have a backend worker project in C# that primarily runs multiple background tasks (non-ignition related) but also wanted to add some ignition related task. So I wanted to access the data from ignition database for this ignition related task.

Any successor in your position will hate you. You should strongly consider doing your Ignition-related tasks in Ignition in a gateway event script.

Thank you for the feedback. So if we have non ignition systems that need only few bits of information from ignition then is there any recommendation? It is not ignition task but an integration task that talks to multiple systems and want to also access specific ignition data, if possible.

The supported way for outside systems to get information from Ignition is to use the WebDev module to implement a web service. The jython scripts backing the web service can call Ignition's scripting API for any desired purpose (including writing into Ignition) without concern over Ignition's implementation details.

That is very good option. Thank you