yobx.sql.ops — register module#

Registration mechanism for SQL operation converters.

Each SQL operation type (e.g. FilterOp, JoinOp) can have exactly one converter registered via register_sql_op_converter(). Converters follow the same API convention as other converters in this package:

def convert_my_op(
    g: GraphBuilder,
    sts: Dict,
    outputs: List[str],
    op: MyOp,
    col_map: Dict[str, str],
    right_col_map: Dict[str, str],
) -> Dict[str, str]:
    ...

where

  • g — the GraphBuilder to add ONNX nodes to.

  • sts — shape/type context dict (may be empty; forwarded verbatim).

  • outputs — the expected output column names (keys of the returned col_map).

  • op — the SQL operation object being converted.

  • col_map — mapping from column name to the current ONNX tensor name (left table).

  • right_col_map — same for the right table (empty dict when not applicable).

The function must return a new col_map reflecting the state after applying the operation.

yobx.sql.ops.register.get_sql_op_converter(cls: type) Callable | None[source]#

Return the converter registered for cls, or None if none is registered.

Parameters:

cls – the SQL operation class to look up.

Returns:

the converter callable, or None.

yobx.sql.ops.register.get_sql_op_converters() Dict[type, Callable][source]#

Return a copy of the full SQL op converter registry.

yobx.sql.ops.register.register_sql_op_converter(cls: type) Callable[source]#

Decorator that registers a converter for a SQL operation class.

Parameters:

cls – the SQL operation class (e.g. FilterOp, JoinOp).

Returns:

the decorator.

Usage:

@register_sql_op_converter(FilterOp)
def convert_filter_op(g, sts, outputs, op, col_map, right_col_map):
    ...