pathwaycom/pathway · error · NotImplementedError

{node.sql()} not supported.

Error message

{node.sql()} not supported.

What it means

Pathway implements SQL by walking the sqlglot expression tree and dispatching each node type to a registered handler (_expression_handlers). NotImplementedError('{node.sql()} not supported.') means the parsed query contains an expression type for which no handler is registered — i.e. the construct is outside Pathway's supported SQL subset, even though sqlglot can parse it.

Source

Thrown at python/pathway/internals/sql/processing.py:43

    contains_reducers: bool

    def __init__(self):
        self.contains_reducers = False

    def eval_reducer(
        self, expression: expr.ReducerExpression, **kwargs
    ) -> expr.ReducerExpression:
        self.contains_reducers = True
        return super().eval_reducer(expression, **kwargs)


_expression_handlers: dict[type[sql_expr.Expression], Callable] = {}


def _run(node: sql_expr.Expression, context: ContextType) -> Any:
    handler = _expression_handlers.get(type(node))
    if handler is None:
        raise NotImplementedError(f"{node.sql()} not supported.")
    return handler(node, context)


def register(nodetype):
    def wrapper(func):
        def inner(node, context):
            assert isinstance(node, nodetype), nodetype
            return func(node, context)

        _expression_handlers[nodetype] = inner
        return inner

    return wrapper


@register(nodetype=sql_expr.If)
def _if(
    node: sql_expr.If, context: ContextType

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Read the printed node SQL (node.sql()) to identify the unsupported construct
  2. Rewrite that part of the query using Pathway's native column expressions (table.select/derive) and keep pw.sql for the rest
  3. Check the Pathway SQL coverage docs/changelog for supported syntax and pin a known-good sqlglot version if an upgrade introduced the issue

Example fix

-- before
SELECT date_trunc('week', ts) FROM t;  -- if unhandled -> NotImplementedError

# after: express unsupported part natively
import pathway as pw
t = pw.sql("SELECT ts FROM t")
out = t.select(week=pw.this.ts.dt_truncate("W"))
Defensive patterns

Strategy: fallback

Try / catch

try:
    tab = pw.sql(query)
except NotImplementedError:
    tab = native_pathway_equivalent(t)  # pre-written native expression version

Prevention

When it happens

Trigger: Calling pw.sql() with constructs Pathway has not implemented: exotic window functions, certain literals/JSON operators, specific date/time functions, or dialect-specific syntax that parses to an unhandled sqlglot node.

Common situations: Porting a query from another engine (Postgres/Spark/Snowflake) that uses functions Pathway's SQL layer doesn't cover yet; upgrading sqlglot, which may parse previously-failing syntax into new node types Pathway doesn't handle.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/8becb15a75de529f. Report an issue: GitHub.