python: how to get notifications for mysql database changes?

后端 未结 5 1307
猫巷女王i
猫巷女王i 2020-11-30 10:43

In Python, is there a way to get notified that a specific table in a MySQL database has changed?

5条回答
  •  醉酒成梦
    2020-11-30 11:20

    It might not be a bad idea to try using a network monitor instead of a MySQL trigger. Extending a network monitor like this:

    http://sourceforge.net/projects/pynetmontool/

    And then writing a script that waits for activity on port 3306 (or whatever port your MySQL server listens on), and then checks the database when the network activity meets certain filter conditions.

    It's a very high level idea that you'll have to research further, but you don't run into the DB trigger problems and you won't have to write a cron job that runs every second.

提交回复
热议问题