Skip to content

Spec model

The spec document and its cached declaration views.

Spec

Bases: StrictModel

The complete JSON document with cached views of its declarations.

name class-attribute instance-attribute

name: str | None = None

spec_version class-attribute instance-attribute

spec_version: Literal[9] = SPEC_VERSION

source class-attribute instance-attribute

source: SpecSource = pydantic.Field(default_factory=lambda: SpecSource(name='manual', generated=False))

dimensions class-attribute instance-attribute

dimensions: dict[str, Dimension] = pydantic.Field(default_factory=dict)

functions class-attribute instance-attribute

functions: FunctionCatalog = pydantic.Field(default_factory=functions_module.FunctionCatalog)

profiles class-attribute instance-attribute

profiles: dict[str, Profile] = pydantic.Field(default_factory=dict)

profile_items cached property

profile_items: list[tuple[ProfileKey, Profile]]

Return profiles with their global IDs in declaration order.

profiles_by_key cached property

profiles_by_key: dict[ProfileKey, Profile]

Return profiles keyed by their globally unique IDs.

profile_keys cached property

profile_keys: dict[str, ProfileKey]

Return each global profile ID's declaration key.

features cached property

features: dict[str, Feature]

Return original feature metadata keyed by ID, including dimensions.

operators cached property

operators: list[Operator]

Return original Operator objects in declaration order, retaining aliases.

operator_items cached property

operator_items: list[tuple[OperatorKey, Operator]]

Return operator occurrences with profile and dictionary keys.

operators_by_key cached property

operators_by_key: dict[OperatorKey, Operator]

Return original Operators keyed by their declaration locations.

operator_profile_keys cached property

operator_profile_keys: dict[OperatorKey, ProfileKey]

Return each operator's owning profile ID.

operator_profiles cached property

operator_profiles: dict[OperatorKey, Profile]

Return each operator's owning profile.

arguments property

arguments: dict[tuple[str, str], Argument]

Return function argument declarations keyed by function and argument.

entrypoints property

entrypoints: list[str]

Return distinct catalog entrypoint strings in declaration order.

feature_owners cached property

feature_owners: dict[str, list[ProfileKey]]

Return all occurrence keys owning each non-dimension feature.

operators_by_function cached property

operators_by_function: dict[str, list[OperatorKey]]

Return operator occurrence keys grouped by function ID.

feature_producers cached property

feature_producers: dict[str, list[OperatorKey]]

Return all operator occurrence keys declaring each output feature.

dimensions_by_profile cached property

dimensions_by_profile: dict[ProfileKey, frozenset[str]]

Return each profile's dimension IDs.

identifiers_by_profile cached property

identifiers_by_profile: dict[ProfileKey, list[str]]

Return profile row identifiers in grain order.

identifier_types_by_profile cached property

identifier_types_by_profile: dict[ProfileKey, dict[str, str]]

Return logical types for profile row identifiers.

relation_types_by_profile cached property

relation_types_by_profile: dict[ProfileKey, dict[str, str]]

Return logical types for declared relations, excluding identifiers.

key_types_by_profile cached property

key_types_by_profile: dict[ProfileKey, dict[str, str]]

Return identifier and relation types together for physical assembly.

identifier_ids cached property

identifier_ids: frozenset[str]

Return all column names selected as profile row identifiers.

key_ids_by_profile cached property

key_ids_by_profile: dict[ProfileKey, frozenset[str]]

Return identifier and relation column names together for each profile.

key_ids cached property

key_ids: frozenset[str]

Return all declared identifier and relation column names.

operator_paths cached property

operator_paths: dict[OperatorKey, SpecPath]

Return model-ID paths used by operator contracts.

declaration_paths cached property

declaration_paths: dict[OperatorKey, SpecPath]

Return dictionary-key paths used by binding validation.

local_features cached property

local_features: dict[ProfileKey, frozenset[str]]

Return column IDs available in each profile, including keys and relations.

input_candidates cached property

input_candidates: dict[OperatorKey, tuple[tuple[str, list[ProfileKey]], ...]]

Return ordered input feature owners, preserving unresolved and ambiguous inputs.

input_sources cached property

input_sources: dict[OperatorKey, ProfileKey | None]

Return the unique source occurrence for each operator, or None when unresolved.

operator_dataframe_arguments cached property

operator_dataframe_arguments: dict[OperatorKey, tuple[DataFrameArgument, ...]]

Return supplied dataframe arguments and their referenced profile IDs.

dataframe_argument_profiles cached property

dataframe_argument_profiles: dict[OperatorKey, tuple[ProfileKey, ...]]

Return resolved profile keys for dataframe arguments in argument order.

dataframe_argument_profile_ids cached property

dataframe_argument_profile_ids: dict[OperatorKey, frozenset[str]]

Return distinct resolved profile IDs for each operator's dataframe arguments.

calculated_feature_producers cached property

calculated_feature_producers: dict[str, tuple[ProfileKey, Operator]]

Return calculated feature IDs mapped to their owning profile and operator.

dataframe_argument_identifiers cached property

dataframe_argument_identifiers: dict[OperatorKey, frozenset[str]]

Return dataframe keys available from each operator's referenced profiles.

binding_selectors_with_paths cached property

binding_selectors_with_paths: tuple[tuple[SpecPath, object, str], ...]

Return binding leaves and argument types with their binding argument paths.

binding_arguments_with_paths cached property

binding_arguments_with_paths: tuple[tuple[SpecPath, BindingArgument, str], ...]

Return typed bound leaves with their binding-collection diagnostic paths.

binding_resources cached property

binding_resources: dict[str, dict[str, BaseModel]]

Return declaration metadata available to structural binding selectors.

matching_profile_keys cached property

matching_profile_keys: dict[OperatorKey, tuple[tuple[str, SpecPath], ...]]

Return selected matching profile keys and their declaration paths.

model_post_init

model_post_init(context: Any) -> None

Collect declarations for explicitly selected builtin merge bindings.

validate_supported_version classmethod

validate_supported_version(value: object) -> object

Reject obsolete documents with actionable rebuild guidance.

rebuild

rebuild() -> typing.Self

Return a fresh Spec after declarations have been edited.

Cached views on this instance are not invalidated when nested declarations change. Rebuild before validating or compiling an edited document.

get_row_context_profile

get_row_context_profile(key: OperatorKey) -> profile_module.Profile | None

Return the context profile, or None when its source is unresolved.

get_row_context_dimensions

get_row_context_dimensions(key: OperatorKey) -> frozenset[str] | None

Return context profile dimension IDs, or None for an unresolved source.

get_row_context_resolution

get_row_context_resolution(key: OperatorKey, dimension_id: str) -> dimension_module.Resolution | None

Return the selected context resolution, or None when it is unavailable.

grain_refines

grain_refines(coarser_profile: ProfileKey, finer_profile: ProfileKey) -> bool

Return whether the finer profile selects descendants of every coarser key.

validate_spec_version_type classmethod

validate_spec_version_type(value: object) -> object

Reject booleans, which Python otherwise treats as integer literals.

normalize_document classmethod

normalize_document(value: Any, info: ValidationInfo) -> typing.Any

Recover keyed resource IDs and resolve profile dimension references.

get_dimensions classmethod

get_dimensions(document: dict[str, Any]) -> typing.Any

Return raw dimension declarations from a document.

get_functions classmethod

get_functions(document: dict[str, Any]) -> typing.Any

Return raw function declarations from a document.

get_profiles classmethod

get_profiles(document: dict[str, Any]) -> typing.Any

Return raw profile declarations from a document.