etymology / backend /sql_loader.py
lucharo's picture
Super-squash branch 'main' using huggingface_hub
13812dc
raw
history blame contribute delete
457 Bytes
"""Load SQL files from the backend/sql/ directory."""
from __future__ import annotations
from functools import cache
from pathlib import Path
SQL_DIR = Path(__file__).parent / "sql"
@cache
def load_sql(filename: str) -> str:
"""Read and cache a SQL file from backend/sql/.
Args:
filename: Relative path within the sql/ directory,
e.g. "queries/find_start_word.sql"
"""
return (SQL_DIR / filename).read_text()