File size: 457 Bytes
13812dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""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()