在python中怎么调用DolphinDB模块函数

我写了一个模块函数如下:

module testmod
def square_sum1(x,y){
    return sum2(x-y)
}

然后用下列代码能正常执行,输出结果9:

s = ddb.session()
s.connect(Dolphin_ip, Dolphin_port,Dolphin_user,Dolphin_password) 
s.run("use testmod;")
df=s.run("testmod::square_sum1",4,1)
print(df)

然后我在testmod模块中又定义了一个模块函数如下:

def testzzz(){
    return `finish
}

在python中调用:

s = ddb.session()
s.connect(Dolphin_ip, Dolphin_port,Dolphin_user,Dolphin_password) 
s.run("use testmod;")
df=s.run("testmod::testzzz")
print(df)

但是执行这段程序,只输出:
testmod::testzzz
不知怎么回事?

请先 登录 后评论

1 个回答

Jason Tang - 时序数据库技术支持

少了个括号;没参数的函数要加括号。

s = ddb.session() 
s.connect(Dolphin_ip,Dolphin_port,Dolphin_user,Dolphin_password) 
s.run("use testmod;")

df=s.run("testmod::testzzz()") 
print(df)
请先 登录 后评论