我正在尝试创建如下所示的函数:
CREATE OR REPLACE FUNCTION test_run(usename text)
RETURNS void
AS $$
import subprocess
from subprocess import call
subprocess.call('/test/tty/sessions.py' + usename , shell=True)
$$
LANGUAGE plpythonu;
和该函数假定要执行/test/tty/sessions.py脚本(该脚本在服务器上本地可用),并且在这种情况下必须带有1个参数 usename 。我尝试了很多不同的选择,但似乎没有用。任何想法/建议请..谢谢..
答案 0 :(得分:0)
您正在尝试运行脚本class Restaurant(models.Model):
name = models.CharField(max_length=100)
class UserPreference(models.Model):
user = models.OneToOneField(User, on_delete=CASCADE)
fruit = models.MantToManyField(Fruit)
vegetable = models.MantToManyField(Vegetable)
class RestaurantPreference(models.Model):
restaurant = models.OneToOneField(Restaurant, on_delete=CASCADE)
fruit = models.MantToManyField(Fruit)
vegetable = models.MantToManyField(Vegetable)
,其中test/tty/sessions.py<username>
是username变量的内容。将<username>
更改为+