Expand description
Database validation operations.
Validates that the target Materialize environment satisfies all prerequisites for deploying the project. Runs before any DDL is executed.
Β§Validation Checklist
| Check | Function | What it verifies |
|---|---|---|
| External databases exist | find_missing_databases | Databases referenced by external dependencies are present |
| External schemas exist | find_missing_schemas | Schemas referenced by external dependencies are present |
| Clusters exist | find_missing_clusters | All clusters in project.cluster_dependencies are present |
| External objects exist | find_missing_external_dependencies | Objects outside the project that are referenced exist in the catalog |
| Cluster isolation | validate_cluster_isolation_impl | Sources/sinks donβt share clusters with MVs/indexes (prevents accidental recreation during swap) |
| Privileges | validate_privileges_impl | Current role has USAGE on databases and CREATECLUSTER system privilege |
| Sources exist | validate_sources_exist_impl | Sources referenced by CREATE TABLE FROM SOURCE exist |
| Sink connections exist | validate_sink_connections_exist_impl | Connections referenced by sinks exist |
| Schema ownership | validate_schema_ownership_impl | Current role owns all production schemas that will be swapped |
| Cluster ownership | validate_cluster_ownership_impl | Current role owns all production clusters that will be swapped |
| Table dependencies | validate_table_dependencies_impl | Tables depended on by objects being deployed exist |
Β§Batching Strategy
Catalog lookups use IN clause queries batched in chunks of
LOOKUP_BATCH_SIZE (1000) to avoid exceeding query parameter limits
while minimizing round trips.
EnumsΒ§
- Catalog
Lookup π
ConstantsΒ§
- LOOKUP_
BATCH_ πSIZE
FunctionsΒ§
- build_
compilation_ πerrors - Converts missing external dependencies into user-facing, file-scoped errors.
- build_
object_ πpaths - Reconstructs source file paths for planned objects under
models/. - collect_
external_ πdependencies - Derives the set of external database/schema prerequisites from project dependencies.
- find_
missing_ πclusters - Checks whether all cluster dependencies referenced by the project are present.
- find_
missing_ πdatabases - Checks catalog state for external databases that must pre-exist.
- find_
missing_ πexternal_ dependencies - Checks whether externally-referenced objects actually exist in the target catalog.
- find_
missing_ πschemas - Checks catalog state for external schemas that must pre-exist.
- query_
existing_ πnames - query_
existing_ πobject_ ids - query_
existing_ πschema_ pairs - query_
sources_ πby_ cluster - Internal helper to query which sources exist on the given clusters using IN clause.
- validate_
cluster_ πisolation_ impl - Internal implementation of validate_cluster_isolation.
- validate_
cluster_ πownership_ impl - Internal implementation of validate_cluster_ownership.
- validate_
privileges_ πimpl - Internal implementation of validate_privileges.
- validate_
project_ πimpl - Internal implementation of validate_project.
- validate_
schema_ πownership_ impl - Internal implementation of validate_schema_ownership.
- validate_
sink_ πconnections_ exist_ impl - Internal implementation of validate_sink_connections_exist.
- validate_
sources_ πexist_ impl - Internal implementation of validate_sources_exist.
- validate_
table_ πdependencies_ impl - Internal implementation of validate_table_dependencies.