I am trying to send the outputs I got in python to the database. Like I am reading valves from my plc using the OPC UA server via python. I can read my variables every second, Now I want to send those values to my PostgreSQL database. Any help would be appreciated. Thank you very much again.
I created a connection between python and PostgreSQL by using the psycopg module. And I am able to create the tables using my python script.
2
Answers
I created a connection between python and postgreSQL database by using
I give host details for creating docker image and use it.
Rather than having to script directly with
psycopg
, I usually reccomend using SqlAlchemy, which is a nice wrapper for psycopg that makes editing data in the database much easierEg, by using the same
psycopg
engine you have already set up, you can do: