refactor composer to use sqlalchemy, avoid string concatenations and follow conventions

This commit is contained in:
2026-06-03 12:10:30 -03:00
parent cbc7df8c60
commit be09fcde2c
16 changed files with 546 additions and 273 deletions

View File

@@ -137,6 +137,11 @@ def merge_into_recon(dataset: str, extracted: dict[str, Any]) -> Recon:
relationships = [Relationship.parse(r) for r in (aug.get("relationships", []) or [])]
# Storage-encoding overrides (optional). Keyed by Column.semantic_type; each
# value maps a role (e.g. "as_date") to a SQL template with a `{col}`
# placeholder. The composer merges these over its built-in defaults.
encodings: dict[str, dict[str, str]] = aug.get("encodings", {}) or {}
column_to_tables: dict[str, list[str]] = {}
for t in tables.values():
for c in t.columns:
@@ -150,6 +155,7 @@ def merge_into_recon(dataset: str, extracted: dict[str, Any]) -> Recon:
metrics=metrics,
column_to_tables=column_to_tables,
relationships=relationships,
encodings=encodings,
)