1

I am new to mqtt. I try to figure out how to save the messages send from mqtt publisher to mqtt subscriber into sqldatabase.

I already search online and found some answers but since I did not have any strong background in writing python script, I failed to understand the answer. Some of the answers I found at

Is there a way to store Mosquitto payload into an MySQL database for history purpose?

and

http://jasonbrazeal.com/blog/how-to-build-a-simple-iot-system-with-python/

As from the second link the author wrote that I must have

save_to_db

function to parse the message and store it into database. Can someone explain it to me how to get that done? Do I need to write a new python script or just edit the client subscriber script? And also if there is a link which can guide me in this particular topic would be good too.

Thank you in advance.

Community
  • 1
  • 1
Ling
  • 831
  • 3
  • 17
  • 40
  • Have you searched for any pure Python database examples? First work out how to work with databases then look at combining it with the MQTT client code – hardillb Aug 10 '16 at 10:02
  • thank you hardillb...already got it work.. – Ling Aug 19 '16 at 03:44

0 Answers0