Skip to main content

Code skills

When a formula isn't enough, admins can write a skill in Python. It runs in a sandbox with no network or file access, and strict time and memory limits.

Off by default

Code skills are turned off on every new server. The Code tab then says Code skills are turned off on this server. A server admin can turn them on with DATABLOOM_CODE_SKILLS=on in the server configuration. Enov8 recommends leaving them off unless the server is isolated from other systems. Try a Formula or a Value list first.

Write one function:

def generate(row, parents, rng, params):
"""Return one value for this column.

row values already made for this row, e.g. row["first_name"]
parents the parent rows this row links to, e.g. parents["customers"]["state"]
rng seeded random numbers: rng.random(), rng.randint(a, b), rng.choice(list), rng.gauss(mu, sd)
params options set on the skill or the column, e.g. params.get("prefix", "ACC")
"""
return f"{params.get('prefix', 'ID')}-{rng.randint(1, 999999):06d}"

Always use rng for randomness. That keeps the skill repeatable with the plan's seed.

A plan always runs the saved version of a code skill, so later edits don't change it. In the editor you can start from Sample code… (for example Account number with check digit, NZ IRD number), a Blank template, or Write code with AI from a description.

Sandbox limits

Each value must be produced within 2 seconds. Your server admin can change the limits.