python - 从 MySQL 数据库推送功能

标签 python mysql python-2.7

我有一个 python 应用程序。 我想知道 mysql 中是否有任何功能(即事件或触发器)允许我在数据库中插入数据时通知我的 python 应用程序。 我想避免使用轮询,因为它会对我的数据库造成很大的开销。

最佳答案

它不是直接用于 Python,而是 Is there a way to watch a mysql database for changes using perl?给出了两个选项如何做到这一点:

1.Create an audit table in the database, and have the trigger write the relevant info there; and have your watching application poll the audit table for new entries. You're still polling, but in a controlled way which won't hit the server too hard.

2.Have the trigger call an external app through a UDF.

关于python - 从 MySQL 数据库推送功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26968656/

相关文章:

python - 如何验证字符串中的字符是否属于字母表?

php - Codeigniter 博客中的文章未更新

sql - 帮助 mysql 查询/过程

mysql - 如何在 MySQL 中制作带有计数器的调度程序?

python - 下载 textblob 证书时出错 验证失败

python - 两个相似代码给出不同结果和不同方法执行此任务的原因

python 相当于 matlab unidrnd()

python - 在 shell 脚本中的 shell 脚本中从 Python 脚本创建文件

python - 如何在Python中拥有一个万能的函数调用,可以调用不同的函数?

函数调用时的 Python 列表乘法