sofhiaazzhr's picture
initial structure
efc0c0a
Raw
History Blame
721 Bytes
"""SqlCompiler — IR → (SQL string, parameters list).
Identifiers (table, column names) come from the catalog (trusted).
Values come from IR.filters and are ALWAYS parameterized — never inlined.
Output is validated by sqlglot before reaching the executor.
"""
from dataclasses import dataclass
from ...catalog.models import Catalog
from ..ir.models import QueryIR
from .base import BaseCompiler
@dataclass
class CompiledSql:
sql: str
params: list[object]
class SqlCompiler(BaseCompiler):
"""Deterministic IR → SQL. No LLM."""
def __init__(self, catalog: Catalog) -> None:
self._catalog = catalog
def compile(self, ir: QueryIR) -> CompiledSql:
raise NotImplementedError