Skip to main content

User-defined functions in Studio

Open UDFs under Developer to see the functions available on your connection. You need a Studio role that can open the page and privileges to call or manage the object.

Find a function​

ScopeWhat it identifies
Engine built-inA function supplied by Gnok.
Workspace UDFA custom function or model scoped to your workspace. Your connection and privileges determine which objects you can see and use.

Use Search functions to find a qualified name or signature. The column menus sort results and let you filter by scope, language, return type, and volatility. Rows per page changes the page size. Studio applies search, filters, and sorting before returning each page.

Open the three-dot menu on a row to see its available actions. Built-ins can be tested. Workspace WASM functions and ONNX models can be edited with the appropriate permissions.

Test a function​

  1. Open the row menu and choose Test.
  2. Choose a signature if Studio lists more than one. Studio fills editable defaults for the recognized argument types.
  3. Enter SQL expressions such as CAST(42 AS INTEGER) and inspect the generated SELECT. An explicit cast makes the argument type clear when testing overloads.
  4. Choose Run to see the result or the execution error.

The editor also supports testing. When it has changes that need registration, Save & Run saves those changes before invoking the function. Use the list page's Test to call the registered function as it stands.

Create a WASM function​

Choose Create Function → WASM, enter a catalog-qualified function name, and declare the input types, return type, and volatility. Select the authoring mode that matches what you have.

ModeWhat to provide
Write RustImplement the function using the signature and starter code in the editor. Save sends the source to Studio's isolated compiler worker and registers the resulting WASM component. Studio keeps the saved Rust source for subsequent edits.
Upload .wasmBuild a compatible WebAssembly component in your own project, select the .wasm file, then Save with its matching SQL signature. Keep the project's source files so you can rebuild it when the logic changes.

For the component interface and local build commands, see Writing a WASM UDF. To use the same artifact in another workspace, register it there with that workspace's permissions.

Edit an existing function​

Open Edit from the row menu. For a WASM function with several available signatures, select the Overload you intend to modify and verify the argument and return types.

  • For Studio-authored Rust, edit the saved source in Write Rust, save, and test with representative arguments.
  • For an uploaded component, rebuild it from the source project and select the replacement in Upload .wasm. Use the signature shown in Studio when you build the replacement from the original source project.

Use an ONNX model as a function​

WASM components implement custom SQL logic. ONNX artifacts represent trained models that return predictions from inputs such as invoice amount and payment history. Studio labels registered ONNX models ONNX in the inventory. Use Models → Upload artifact to register a compatible .onnx file, or train one in Studio. See Models in Studio and ONNX inference.