Expand description
Data-contract system for external dependencies.
When a project references objects it does not own (e.g. tables created by an
upstream ingestion pipeline), mz-deploy needs to know their column schemas so
it can type-check views that depend on them. This module manages that contract
through the types.lock file.
§Lock File Lifecycle
- Capture — Column schemas are queried from the live environment and
written to
types.lock. - Compile — The lock file is loaded and its schemas are used to resolve external dependency columns during compilation.
- Validate — During incremental typechecking, external dependency schemas are provided to the validation backend when dirty objects reference them.
§Compiler Integration
Incremental runtime typechecking is owned by
crate::project::compiler::typecheck. That subsystem persists per-object
validation artifacts for consumers such as explain and the LSP.
This module owns:
- the
types.lockcontract format - shared type/schema utilities such as
type_hash
§Key Types
Types— In-memory representation of atypes.lockfile: a versioned map from fully-qualified object names to column schemas, plus optional object-level comments fromCOMMENT ONin the source database.ColumnType— A single column’s type name, nullability, and optionalCOMMENT ON COLUMNdescription.
Structs§
- Column
Lock 🔒 - Column
Type - A single column’s type name, nullability, and optional comment in a data contract.
- Object
Lock 🔒 - Types
- In-memory representation of a
types.lockfile. - Types
Lock 🔒 - TOML serialization format for types.lock
Enums§
- Object
Kind - The kind of database object recorded in a
types.lockentry. - Types
Error - Errors that can occur when reading, writing, or parsing
types.lockfiles.
Constants§
- BUILD_
DIR 🔒 - Directory name for mz-deploy build artifacts.
Functions§
- escape_
toml_ 🔒string - Escape a string for use as a TOML basic string value.
- load_
types_ 🔒lock - Load the types.lock file from the specified directory. Returns an error if the file doesn’t exist or cannot be parsed.
- write_
toml 🔒 - Hand-format a
TypesLockas TOML with per-kind sections and inline columns.