feat: refactor project

This commit is contained in:
Stijnvandenbroek
2026-03-06 14:51:26 +00:00
parent c908d96921
commit 535a09fd75
28 changed files with 1136 additions and 51 deletions

View File

@@ -45,10 +45,13 @@ settings = Settings()
def load_sql(name: str) -> str:
"""Load a SQL template from the sql/ directory and inject schema/table names."""
raw = (SQL_DIR / name).read_text()
return raw.format(
listings_schema=settings.LISTINGS_SCHEMA,
listings_table=settings.LISTINGS_TABLE,
elo_schema=settings.ELO_SCHEMA,
images_schema=settings.IMAGES_SCHEMA,
images_table=settings.IMAGES_TABLE,
)
replacements = {
"listings_schema": settings.LISTINGS_SCHEMA,
"listings_table": settings.LISTINGS_TABLE,
"elo_schema": settings.ELO_SCHEMA,
"images_schema": settings.IMAGES_SCHEMA,
"images_table": settings.IMAGES_TABLE,
}
for key, value in replacements.items():
raw = raw.replace("{{ " + key + " }}", value)
return raw