feat(tht): promoted_columns_for helper (curated column set)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user