Skip to main content
The Custom SQL node lets you write SQL queries against pipeline data. Queries run locally using Apache DataFusion, a high-performance analytical SQL engine that supports standard PostgreSQL syntax. Your upstream data is available as a table called input.

SQL dialect

Custom SQL uses PostgreSQL-compatible syntax. Standard SQL features are fully supported:
  • Common table expressions (CTEs) with WITH
  • Window functions (ROW_NUMBER, RANK, LAG, LEAD, etc.)
  • JOIN / LEFT JOIN / CROSS JOIN
  • UNION ALL / INTERSECT / EXCEPT
  • Subqueries (scalar, IN, EXISTS)
  • CASE WHEN / COALESCE / NULLIF
  • FILTER clause on aggregates
  • Type casting with CAST(), TRY_CAST(), and :: syntax
  • INTERVAL arithmetic
  • Boolean expressions and IS [NOT] NULL

Function reference

Common patterns

Deduplicate rows

Keep only the latest record per key:

Running total

Pivot with CASE WHEN

PIVOT syntax is not supported. Use CASE WHEN instead:

Unpivot with UNION ALL

UNPIVOT syntax is not supported. Use UNION ALL instead:

Conditional aggregation with FILTER

Gap detection

Execution engines

Each Custom SQL node can run on a different engine. Choose the best one for your workload: Set the default engine in Settings → Compute. Override per-node using the engine selector dropdown in the Custom SQL configuration panel.
Use the Execution Plan preview to see which engine each node will use before running the pipeline.

AI assistance

The AI Copilot can generate Custom SQL from natural language descriptions. Open the prompt box in the Custom SQL editor and describe what you need. Copilot generates PostgreSQL-compatible SQL targeting the DataFusion engine. Use Check with AI to validate your SQL for syntax errors, type mismatches, and performance suggestions.

Advanced nodes

All advanced node types including Python and Notebooks.

SQL assistance

AI-powered SQL generation and optimization.

Pipeline troubleshooting

Common errors and debugging steps.

Compute settings

Configure default SQL engine and thresholds.