Skip to main content

Module validation

Module validation 

Source
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

CheckFunctionWhat it verifies
External databases existfind_missing_databasesDatabases referenced by external dependencies are present
External schemas existfind_missing_schemasSchemas referenced by external dependencies are present
Clusters existfind_missing_clustersAll clusters in project.cluster_dependencies are present
External objects existfind_missing_external_dependenciesObjects outside the project that are referenced exist in the catalog
Cluster isolationvalidate_cluster_isolation_implSources/sinks don’t share clusters with MVs/indexes (prevents accidental recreation during swap)
Privilegesvalidate_privileges_implCurrent role has USAGE on databases and CREATECLUSTER system privilege
Sources existvalidate_sources_exist_implSources referenced by CREATE TABLE FROM SOURCE exist
Sink connections existvalidate_sink_connections_exist_implConnections referenced by sinks exist
Schema ownershipvalidate_schema_ownership_implCurrent role owns all production schemas that will be swapped
Cluster ownershipvalidate_cluster_ownership_implCurrent role owns all production clusters that will be swapped
Table dependenciesvalidate_table_dependencies_implTables 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Β§

CatalogLookup πŸ”’

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.