How can I dynamically pass parameters to clause after set in DolphinDB? For example, update quote set fname = ufunc(k)
, where fname
is a variable ufunc
is a custom function, and k is an external variable. How should I implement it?
Asked
Active
Viewed 15 times
0
1 Answers
0
You can refer to the following example, use function sqlUpdate
with sqlColAlias
. More examples can be found in the link below about
Meta programming.
t1=table(`A`A`B`B as symbol, 2021.04.15 2021.04.16 2021.04.15 2021.04.16 as date, 12 13 21 22 as price)
b = `price
c = t1.price
def ufunc(b){
return b+1}
sqlUpdate(t1, sqlColAlias(makeCall(ufunc, c), b)).eval()
t1

dbaa9948
- 189
- 2
- 10