mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
Overlay sources now have two distinct collections: `columns:` for computed columns (requiring `expr` + `type`) and `column_overrides:` for metadata patches to inherited manifest columns. Composing or loading an overlay that mixes the two — or references an unknown column — fails with a typed error. Introduce `ResolvedSemanticLayerSource` / `resolvedSourceSchema` / `toResolvedWire` as the strict shape sent to the Python engine, and add a schema contract test that diffs Zod against the Pydantic JSON schema dumped by `python -m semantic_layer dump-schema`. `SourceDefinition` is now `extra="forbid"` on the Python side. `loadAllSources` surfaces per-file load errors instead of swallowing them, so validation/query paths can report manifest shard parse failures.
22 lines
494 B
Python
22 lines
494 B
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
|
|
from semantic_layer.cli import main as cli_main
|
|
from semantic_layer.models import SourceDefinition
|
|
|
|
|
|
def dump_schema() -> None:
|
|
json.dump(
|
|
SourceDefinition.model_json_schema(), sys.stdout, indent=2, sort_keys=True
|
|
)
|
|
sys.stdout.write("\n")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) > 1 and sys.argv[1] in {"dump-schema", "schema"}:
|
|
sys.argv.pop(1)
|
|
dump_schema()
|
|
else:
|
|
cli_main()
|