I have a desire to call the python script from the mysql query.
我希望从mysql查询中调用python脚本。
like we call the procedure in mysql : call procedurename();
就像我们在mysql中调用过程一样:call procedurename();
just like as above is there any way in mysql to call external scripts like ,
就像上面那样在mysql中有任何方法可以调用外部脚本,比如
call script(somefile.py)
i wrote the above thing to explain the exactly what i want.
我写了上面的东西来解释我想要的确切内容。
1 个解决方案
#1
2
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.
出于安全原因,这在MySQL中似乎不可能。你可以看看这个相关的问题从MySQL执行shell命令。但是,您可以在其他数据库(如oracle)中执行此操作。在Postgresql中,还支持在数据库中创建python存储过程。您可以使用此技术让您的数据库触发器运行python代码。
#1
2
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.
出于安全原因,这在MySQL中似乎不可能。你可以看看这个相关的问题从MySQL执行shell命令。但是,您可以在其他数据库(如oracle)中执行此操作。在Postgresql中,还支持在数据库中创建python存储过程。您可以使用此技术让您的数据库触发器运行python代码。