starl

Function

ArgDescriptionType
codeThe body of the starlark code.string (required)
keyIf set use this key to cache the Starlark code block.string
globalsDictionary of values to feed into Starlark environmentAny

Description

Compile a starlark code block - returns a module usable in VQL

Starl allows python like code to be used with VQL. This helps when we need some small functions with more complex needs. We can use a more powerful language to create small functions to transform certain fields etc.

Example

In the following example we define a Starl code block and compile it into a module. VQL code can then reference any functions defined within it directly.

LET MyCode <= starl(code='''
load("math.star", "math")

def Foo(X):
  return math.sin(X)

''')

SELECT MyCode.Foo(X=32)
FROM scope()