Expand description
Database client layer for communicating with a Materialize region.
All interaction with the live database flows through this module. The
Client type (defined in connection) holds a tokio_postgres
connection and exposes scoped sub-clients that group related operations:
introspection— Read-only catalog queries: schema/cluster/object existence checks, dependency lookups, and batch metadata retrieval.provisioning— DDL operations that create or alter databases, schemas, and clusters to match the project definition.deployment_ops— Blue/green deployment lifecycle: staging, hydration monitoring, cutover, and abort.validation— Pre-deployment validation: checks that the target environment matches expected state before applying changes.type_info—SHOW COLUMNSqueries used to generate and refresh thetypes.lockdata-contract file.
§Supporting Submodules
models— Data structures shared across sub-clients (deployment records, cluster configs, conflict records, etc.).errors— Error types:ConnectionErrorfor transport/query failures,DatabaseValidationErrorfor semantic mismatches.
Most sub-client types are internal; this module re-exports the key public
types so that consumers only need use crate::client::*.
Re-exports§
pub use crate::config::Profile;
Structs§
- Client
- Database client for interacting with Materialize.
- Cluster
- A compute cluster in Materialize.
- Cluster
Options - Options for creating a new cluster.
- Cluster
Replica - Configuration for a cluster replica (used for unmanaged clusters).
- Cluster
Status Context - Full status context for a cluster in a staging deployment.
- Conflict
Record - A conflict record indicating a schema was updated after deployment started.
- Dependent
Sink - A sink that depends on an object in a schema being dropped.
- Deployment
Details - Details about a specific deployment.
- Deployment
History Entry - A promoted deployment in history.
- Deployment
Metadata - Metadata about a deployment.
- Deployment
Object Record - An object deployment record tracking object-level deployment history.
- DevOverlays
Client - Domain sub-client for developer overlay manifest operations.
- Hydration
Status Update - A hydration status update from the SUBSCRIBE stream.
- Object
Grant - A privilege grant on a cluster.
- Pending
Statement - A pending statement to be executed after the swap.
- Production
Cluster Record - A cluster known to host at least one promoted deployment.
- Replacement
MvRecord - A replacement materialized view record tracking the mapping between the replacement MV (in staging schema) and its production target.
- Schema
Deployment Record - A schema deployment record tracking when and how a schema was deployed.
- Staging
Deployment - Summary of a staging deployment.
Enums§
- Apply
State - State of an apply operation for resumable apply.
- Cluster
Config - Configuration for creating a cluster (managed or unmanaged).
- Cluster
Deployment Status - Status of a cluster in a staging deployment.
- Connection
Error - Errors that can occur during database operations.
- Database
Validation Error - Errors that can occur during project validation against the database.
- Deployment
Kind - The type of deployment - either tables-only or full objects.
- Deployment
Mode - Deployment mode tag stored alongside each deployment.
- Failure
Reason - Reason why a cluster deployment is failing.
Constants§
- DEFAULT_
ALLOWED_ LAG_ SECS - Default allowed lag threshold in seconds (5 minutes).
- SERVER_
CLUSTER_ NAME - Name of the dedicated cluster mz-deploy creates during
setupand pins every connection to via libpq options.
Functions§
- format_
relative_ path - Extract last 3 path components for display (database/schema/file.sql).
- quote_
identifier - Double-quote a SQL identifier, escaping any embedded double quotes.
- sql_
placeholders - Build a comma-separated
$1, $2, …, $nplaceholder string for parameterized queries.