edgeLakeCodeQuery
Execute JavaScript programs server-side against Edge Lake event data for complex analysis that requires multiple queries, joins, aggregations, or funnel analysis.
Use dedicated analytics tools first (domainAnalytics, domainErrors, edgeLakeTrafficAnalysis) before falling back to Edge Lake queries. Use edgeLakeQuery for simple single queries. Use edgeLakeCodeQuery only when you need multi-step analysis.
Parameters
channelId
string (UUID)
Yes
The Edge Lake channel ID. Must be a channel with providerId: "edgeLake". Get this from the domains tool.
teamId
string (UUID)
Yes
The team ID the domain belongs to.
code
string
Yes
JavaScript code to execute server-side. Has access to codemode.query(sql) which returns { rows, meta }. Must return the final result.
Constraints
Maximum 20 queries per execution
80-second timeout
100KB maximum result size
Must return a final result (the last expression or explicit return)
API
Your code has access to:
codemode.query(sql)- Execute an SQL query againstlake.events. Returns{ rows, meta }.Promise.all()- Run multiple queries in parallel.Standard JavaScript (no external libraries).
Examples
Conversion funnel
Daily revenue trend
Edge Lake Querying must be enabled for your domain. Contact [email protected] if you get an "Action not permitted!" error.
Last updated
Was this helpful?

