Skip to content
  • There are no suggestions because the search field is empty.

dbt - Placeholder values

Applies to
Platform: Snowflake dbt · Databricks dbt

Set the values that the generated dbt_project.yml leaves as <placeholder>: the profile, the layer schemas and the source locations. Do this before you run the project. Afterwards dbt finds your profile and builds the models in your target schemas.

A dbt project has no replace_placeholders.ps1 and no replacement_config.json, unlike the artifacts described in Replace the placeholders in the artifacts. You edit dbt_project.yml directly.

Prerequisites

  • The target environment is prepared, with a connection profile in profiles.yml:
    • Databricks dbt: Target environment
    • Snowflake dbt: no target environment article available yet
  • The artifacts are generated and downloaded.

Values to set

  • profile: the name of your profile in profiles.yml.
  • +schema under each layer: the second part of the layer's schema. dbt creates the models of the layer in <profile schema>_<layer schema>, where <profile schema> is the schema of the profile. A Data Vault project has the layers stage, rawvault and businessvault.
  • <source system>_catalog and <source system>_schema: the catalog and the schema that hold the tables of a source system. The project has one pair for each source system, named after it in lower case.

The profile also sets the target catalog or database. The layers write to it, and dbt reads the sources from the location in the variables.

Set the values

  1. Open dbt_project.yml in the root folder of the downloaded artifacts.
  2. Replace <placeholder> of profile with the name of your profile.
  3. Replace <placeholder> of each +schema with the schema part of the layer, for example the layer name.
  4. Replace <placeholder> of each source variable with the catalog or schema of the source tables.
  5. Search the file for <placeholder>. No match remains. Save the file.

Each generation writes dbt_project.yml with <placeholder> again. Keep your values and enter them again after each generation.

Example

A Databricks dbt project with the source system bfmmssql, whose tables are in the schema bfm of the catalog landing. The profile dwh has the catalog dwh_dev and the schema analytics. The edited part of dbt_project.yml:

models:
  datavault_spark_databricks_dbt:
    +contract:
      enforced: true
    businessvault:
      +schema: businessvault
    rawvault:
      +schema: rawvault
    stage:
      +schema: stage

vars:
  # source systems
  bfmmssql_catalog: landing
  bfmmssql_schema: bfm

profile: 'dwh'

dbt then reads the source table customer as `landing`.`bfm`.`customer` and writes these tables:

`dwh_dev`.`analytics_stage`.`stg_st_customer`
`dwh_dev`.`analytics_rawvault`.`rdv_hub_common_customer`
`dwh_dev`.`analytics_businessvault`.`bdv_hub_load_bhub`

Check the result

Open a terminal in the artifacts folder and run dbt debug. The output ends with All checks passed!, which shows that dbt found the profile and connected. It does not check the source variables or the layer schemas.

Failure symptoms and recovery

dbt does not find the profile

Message: Could not find profile named '<placeholder>'
Cause: profile in dbt_project.yml still holds the placeholder.
Fix: Enter the name of your profile and run the command again.

Platform differences

  • Snowflake dbt: the source variables are <source system>_database and <source system>_schema. Each layer also has +snowflake_warehouse: enter the warehouse that runs the models of the layer. With Apply Sensitivity Level Tags on, the variables governance_tags_database and governance_tags_schema name the location of the tag.
  • Databricks Dbt DataMart: one layer, mart. The source variables belong to the linked source systems: enter the catalog and schema of the linked project's tables, for example rawvault_catalog and rawvault_schema.
  • Databricks Dbt DataVault & Mart: four layers, stage, rawvault, businessvault and mart. Source variables exist only for the source systems.

Related articles