from pathlib import Path from jinja2 import Template from loguru import logger from ..config import TABLES class QueryLoader: def __init__(self, tables: dict[str, str] | None = None): self.tables = tables or TABLES def load(self, path: Path, **kwargs) -> str: logger.debug(f"Loading query from {path}") with open(path, "r") as f: template = Template(f.read()) return template.render(**self.tables, **kwargs)