feat(tht): promoted_columns_for helper (curated column set)

This commit is contained in:
2026-07-06 23:25:00 +02:00
committed by Marco Pancotti
parent ad5a4d938c
commit 3ed570ee60
2 changed files with 37 additions and 0 deletions
+15
View File
@@ -54,6 +54,21 @@ def promoted_tables_for(cfg, session_id: str | None) -> set[str] | None:
}
def promoted_columns_for(cfg, session_id: str | None) -> set[str] | None:
if session_id is None:
return None
linking_path = cfg.paths.sessions / session_id / "schema_linking.json"
if not linking_path.exists():
return None
from tht.session.models import SchemaLinking
linking = SchemaLinking.model_validate(json.loads(linking_path.read_text()))
return {
c.name for c in linking.candidates
if c.kind == "column" and c.decision == "promoted"
}
def validate_or_exit(cfg, sql: str, session_id: str | None):
"""Validazione statica; stampa errori/warning. Exit 1 sugli errori."""
from tht.sqlcheck import validate_sql