Expand description
Object validation and compiled-project assembly.
This module turns source-owned objects into validated compiled objects and assembles the full compiled project from those validated results.
Validation is defined per logical object:
- classify statements and require exactly one primary create statement
- validate names against the source-owned object key
- normalize identifiers and dependencies into canonical qualified form
- validate clusters, references, comments, and grants
- resolve active profile variants and reject incompatible overrides
Project assembly validates database and schema setup statements on every
invocation, groups validated objects by (database, schema), and enforces
schema-wide invariants before producing a compiled project.
§Per-Object Validation (in validate_single_variant)
- Statement classification — exactly one main CREATE statement per file
- Name validation — object name matches file stem, FQN matches path
- Identifier format — lowercase, valid characters
- Name normalization — fully qualify all references via
NormalizingVisitor - Cluster validation — MVs, sinks, sources, indexes have required
IN CLUSTER - Reference validation — indexes, grants, comments reference the parent object
§Profile Variant Handling
Objects may have multiple file variants (e.g., conn.sql and
conn#staging.sql). All variants are classified for type consistency,
then only the active variant (matching profile or default) is fully
validated. Views and materialized views do not allow profile overrides.
Modules§
- clusters 🔒
- Cluster validation for object statements.
- identifiers 🔒
- Identifier validation for database objects.
- references 🔒
- Reference validation for supporting statements.
- schema_
constraints 🔒 - Schema-level constraint validation.
Structs§
Functions§
- assemble_
project 🔒 - classify_
variant_ 🔒object_ type - Classify statements in a single variant and determine its object type.
Returns
(ObjectType, path)on success, or errors. - derive_
replacement_ 🔒schemas - Scan all schemas for
SET api = stablestatements and build the set of replacement schemas. - object_
type_ 🔒name - A human-readable name for an ObjectType.
- validate_
replacement_ 🔒schemas - Validate replacement schemas derived from
SET api = stablestatements. - validate_
single_ 🔒variant - Validate a single variant’s statements fully and produce a compiled object.