Skip to content

PlatformAnalyse

Functions

The calculation SQL can't say, written in Python

A function is Python code from your project, run by the nodes of your flows on a fixed, isolated runtime. It takes tables, returns a table, and runs the same in the cloud and on the node.

Function · z_deviationv3
def transform(inputs, params, ctx):
    rows = inputs["rows"].copy()
    col = params["column"]
    rows["z"] = (rows[col] - rows[col].mean()) / rows[col].std()
    return {"rows": rows}

Input rows · table

Output rows · table

pandas · scikit-learn · no network

Illustrative example

Python where you need it, on the same data

  • A fixed, known runtime

    numpy, pandas, pyarrow, scipy, scikit-learn, onnxruntime and joblib. No network and no installs, so the result is the same wherever it runs.

  • Tables in, table out

    Inputs arrive as pandas DataFrames and the function returns its rows. The contract declares columns and parameters, and the flow checks it.

  • Try it and watch it work

    From the Test tab you run the saved version on a sample of data before it reaches a flow. A debug view helps you see what the code does.

  • Versions and approval

    Every save is a version. Project code in a flow needs an administrator's approval.

How you write a function

  1. 01

    Write the code

    In the Lab you write the function in the Code tab. Athena, a separate AI module, can draft the code.

  2. 02

    Declare the contract

    You say which tables go in and which columns come out, plus the parameters. The parameters become the node's form in the flow.

  3. 03

    Put it in a flow

    The function becomes a node of a flow, which runs it on a schedule or on new data.

In detail

Language
Python.
Libraries
numpy, pandas, pyarrow, scipy, scikit-learn, onnxruntime, joblib.
Isolation
No network and no package installs.
Where it runs
The same in cloud flows and on the node, on amd64 and arm64.
Inputs and outputs
Tables as pandas DataFrames; you return a table.
It can
Compute indices and deviations, or fit a scikit-learn model on the data it receives.
Company libraries
.whl files uploaded once and imported by functions, node programs and notebooks.
In a flow
A function can be written in place, in a flow's block, starting from the columns arriving at that point.

Frequently asked questions

Not just any. The base is fixed: the libraries are the ones listed and packages are not installed from the internet. For code you use often you can upload your company's Python libraries once, as .whl files, and import them in functions. This is what keeps execution identical in the cloud and on the node.

Bring us a question you can't answer today.

We start from a real question your business has and walk the path from source to dashboard with your systems, not a demo dataset.