feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s
Publish documentation / publish (push) Successful in 2m12s
This commit is contained in:
@@ -118,6 +118,24 @@ def _load_effective_relationships(cfg, physical: PhysicalSchema) -> dict[str, li
|
||||
|
||||
|
||||
def load_schema_context(cfg, *, physical_file: Path | None = None) -> SchemaContext:
|
||||
if physical_file is None and cfg.paths.catalog_metadata_snapshot is not None:
|
||||
from tht.mschema.catalog_snapshot import (
|
||||
CatalogSnapshotError,
|
||||
load_catalog_metadata_snapshot,
|
||||
)
|
||||
|
||||
try:
|
||||
snapshot = load_catalog_metadata_snapshot(
|
||||
cfg.paths.catalog_metadata_snapshot, cfg._workspace_id
|
||||
)
|
||||
physical, annotations, relationships = snapshot.to_schema_inputs()
|
||||
except CatalogSnapshotError as exc:
|
||||
raise SchemaContextError(str(exc)) from exc
|
||||
return SchemaContext(
|
||||
physical=physical,
|
||||
annotations=annotations,
|
||||
effective_relationships=relationships,
|
||||
)
|
||||
physical_file = physical_file or physical_path(cfg)
|
||||
if not physical_file.is_file():
|
||||
raise SchemaContextError(f"physical schema is missing: {physical_file}")
|
||||
|
||||
Reference in New Issue
Block a user