Hi all,
I'm setting up an ML backend on the same machine running the Ignition gateway service. The gateway machine has its own local PostgreSQL database. I want to periodically sample data from tags (pumps, valves, flowmeters, etc.) into local PostgreSQL views/tables, so the local ML backend (running in Docker on the same machine) can process it. I cannot use SQL Bridge module.
How can I achieve this?
Write script functions in the project library called from either a gateway timer event or a gateway scheduled event. The function(s) would have the following basic structure:
-
Use system.tag.readBlocking()
and/or system.opc.readValues()
to acquire fresh data. The list of tag paths and/or OPC item paths can be a script top-level constant initialized outside any function.
-
Use system.db.runPrepUpdate()
to run the INSERT on the database, where ?
parameters are placed in the SQL where the raw data needs to be, and the raw data is supplied as the parameters list to that system function. If you are always using the same list of tags/OPC items, you can make the SQL template a script top-level constant, too.
2 Likes
I was hoping it wouldn't come to that. Unfortunately, it seems like it is the only solution
Well, the simple method is to use the SQL Bridge module. But you said you cannot. 
1 Like