feat: refactor project
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user