from tht.mschema.models import Annotations, PhysicalSchema def find_orphans(physical: PhysicalSchema, annotations: Annotations) -> list[str]: """Annotazioni che puntano a oggetti spariti dal fisico. Non le rimuove mai.""" orphans: list[str] = [] for table_name, table_ann in annotations.tables.items(): table = physical.tables.get(table_name) if table is None: orphans.append(table_name) continue for column_name in table_ann.columns: if column_name not in table.columns: orphans.append(f"{table_name}.{column_name}") return orphans