| Ocalt Query Language
Pricing Dashboard ocalt.com v1.0

WEBASSEMBLY

Execute JavaScript or Python server-side in a sandboxed subprocess. Use GRANT WEBASSEMBLY to pass OQL variables in. Use return to pass values back. Use ENTER for multiple named code blocks in one WEBASSEMBLY call.

VerbDescription
WEBASSEMBLY AS "js" `code` SET ?resultExecute JavaScript (Node.js sandbox). Use return to return a value.
WEBASSEMBLY AS "python" `code` SET ?resultExecute Python 3. Stdout is captured as the result.
WEBASSEMBLY AS "wasm" "/root/app.wasm" SET ?resultRun a compiled .wasm binary. Operand is the path.
GRANT WEBASSEMBLY ?var AS "alias"Pass an OQL variable into the sandbox. Must precede the WEBASSEMBLY call.
GRANT WEBASSEMBLY !CONST AS "alias"Pass an immutable system variable into the sandbox.
WEBASSEMBLY AS "js" OPEN NEST ENTER `code` SET ?r ... CLOSE NESTMultiple named code blocks — each ENTER runs independently and binds its own result.

Basic JavaScript

WEBASSEMBLY AS "js" `return 2 + 2` SET ?r AFTER EMIT ?r (* → 4 *)
Try it ›

Multi-line JavaScript — return works

WEBASSEMBLY AS "js" ` const nums = [3,1,4,1,5,9,2,6]; return nums.sort((a,b) => b-a).join(", "); ` SET ?result AFTER EMIT ?result (* → "9, 6, 5, 4, 3, 2, 1, 1" *)
Try it ›

Basic Python

WEBASSEMBLY AS "python" ` nums = [3,1,4,1,5,9] print(sum(nums)) ` SET ?r AFTER EMIT ?r (* → 23 *)
Try it ›

GRANT WEBASSEMBLY — pass OQL variables into the sandbox

Grant each variable before the WEBASSEMBLY call. Inside the sandbox read them with oql_get("alias"). Values are always strings — use JSON.parse() for objects and arrays.

SPLIT "banana,apple,cherry" WITH "," SET ?fruits AFTER GRANT WEBASSEMBLY ?fruits AS "fruits" AFTER WEBASSEMBLY AS "js" ` const items = JSON.parse(oql_get("fruits")); return items.map(f => f.toUpperCase()).join(" | "); ` SET ?result AFTER EMIT ?result (* → "BANANA | APPLE | CHERRY" *)
Try it ›

Multiple GRANTs

STRING "Bongani" SET ?name AND CALCULATE "1987" SET ?year AFTER GRANT WEBASSEMBLY ?name AS "name" AFTER GRANT WEBASSEMBLY ?year AS "year" AFTER WEBASSEMBLY AS "js" ` const name = oql_get("name"); const year = parseInt(oql_get("year")); const age = new Date().getFullYear() - year; return name + " is approx " + age + " years old"; ` SET ?r AFTER EMIT ?r
Try it ›

ENTER — multiple code blocks in one WEBASSEMBLY call

Each ENTER runs its code block independently in the specified language and binds the result to its own variable. Grants are shared across all ENTERs.

WEBASSEMBLY AS "js" OPEN NEST ENTER `return 2 + 2` SET ?a ENTER `return "hello".toUpperCase()` SET ?b ENTER `return Math.PI.toFixed(4)` SET ?pi CLOSE NEST AFTER EMIT ?a & " | " & ?b & " | " & ?pi (* → "4 | HELLO | 3.1416" *)
Try it ›

GRANT WEBASSEMBLY with ENTER

STRING "Engineering Magic" SET ?motto AFTER GRANT WEBASSEMBLY ?motto AS "motto" AFTER WEBASSEMBLY AS "js" OPEN NEST ENTER `return oql_get("motto").split(" ").length` SET ?words ENTER `return oql_get("motto").toUpperCase()` SET ?upper CLOSE NEST AFTER EMIT ?words & " words: " & ?upper
Try it ›

Process data from a database query

QUERY "players" FROM "game" SET ?rows AFTER GRANT WEBASSEMBLY ?rows AS "rows" AFTER WEBASSEMBLY AS "js" ` const players = JSON.parse(oql_get("rows")); const sorted = players.sort((a,b) => b.score - a.score); return sorted.slice(0,3).map((p,i) => (i+1)+". "+p.name+" — "+p.score).join("\n"); ` SET ?leaderboard AFTER EMIT ?leaderboard

Supported languages

AS valueRuntimeNotes
"js" or "javascript"Node.jsSandboxed via bwrap. return passes value back. 10s timeout.
"python" or "py"Python 3Restricted env. print() captured as result.
"wasm"wasmtimeOperand is path to compiled .wasm binary.
oql_get("alias") is available inside JS and Python sandboxes. Values are always serialised as strings — use JSON.parse() when the original is an object or array. Each ENTER block runs in an isolated subprocess — OQL variables flow in via GRANT, results flow out via return (JS) or print() (Python).