dbt - Analytics Engineering Certification Study Guide

    2: Managing dbt models governance

    This chapter walks through the four governance mechanisms that turn a working dbt project into a contract-bound, versioned, access-controlled, and self-documenting analytical platform. It covers model contracts that fail builds on schema drift, model versions that let producers iterate without breaking downstream consumers, access modifiers and groups that enforce import boundaries inside a single project, and the documentation surface that ties sources, columns, exposures, and lineage into a queryable catalog.

    Learning Objectives

    By the end of this chapter, you will be able to:

    • Add an enforced contract to a dbt model and declare per-column data_type plus warehouse-supported constraints.
    • Publish a second version of a model with versions:, override its file location with defined_in:, and announce removal through deprecation_date:.
    • Choose between private, protected, and public access modifiers and bind models to a group with a declared owner.
    • Author source and column descriptions, factor reusable text into {% docs %} blocks, and persist column descriptions to the warehouse so BI tools see them.

    Executive Summary

    • A contract is a build-time guarantee about the SHAPE of a model: column names, ordered data_type declarations, and (where the warehouse supports them) not_null, primary_key, unique, foreign_key, and check constraints.
    • Versions express that more than one definition of a logical model exists at once: v1 keeps serving downstream consumers while v2 ships a breaking change, and deprecation_date: turns the deletion timeline into a warning the compiler prints on every run.
    • Access modifiers (private, protected, public) and groups: form an import system inside the project: a private model can only be referenced by other models in the same group, and protected (the default) keeps a model internal to its project.
    • Documentation is not a side car. description: on sources and columns, {% docs %} block reuse, persist_docs: propagation to the warehouse, and dbt docs generate together produce the catalog that downstream BI and discovery tools read.

    Assumptions

    • The reader has a working dbt project on a cloud warehouse (Snowflake, BigQuery, Databricks, Redshift, or Postgres) and is comfortable with the ref() / source() / materialized surface introduced previously.
    • The reader runs dbt against a single project. Cross-project mesh references are out of scope for this exam and are handled in the dbt Cloud Certified Architect material.
    • Warehouse capability differences for contracts and constraints are called out where they alter behavior. Always cross-check the dbt adapter page for the specific platform you are deploying against.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account