且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从mysql查询中运行python脚本?

更新时间:2023-10-21 13:09:04

出于安全原因,这在MySQL中似乎无法实现.您可以查看以下相关问题:从MySQL执行shell命令.但是,您可以在其他数据库(如oracle)中执行此操作.在Postgresql中,还支持在数据库中创建 Python存储过程 .您可以使用此技术使您的数据库触发器运行python代码.

This does not seem to be possible in MySQL, for security reasons. You can have a look at this related question Executing shell command from MySQL. You can however do this in other database like oracle. In Postgresql there is also support to create python stored procedures in the database. You could use this technique to have your database triggers run python code.