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 inprofiles.yml.+schemaunder 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 theschemaof the profile. A Data Vault project has the layersstage,rawvaultandbusinessvault.<source system>_catalogand<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
- Open
dbt_project.ymlin the root folder of the downloaded artifacts. - Replace
<placeholder>ofprofilewith the name of your profile. - Replace
<placeholder>of each+schemawith the schema part of the layer, for example the layer name. - Replace
<placeholder>of each source variable with the catalog or schema of the source tables. - 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>_databaseand<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 variablesgovernance_tags_databaseandgovernance_tags_schemaname 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 examplerawvault_catalogandrawvault_schema.Databricks Dbt DataVault & Mart: four layers,stage,rawvault,businessvaultandmart. Source variables exist only for the source systems.
Related articles
- Previous: Generate artifacts, Download generated artifacts
- Snowflake dbt: no target environment article available yet
- Databricks dbt: Target environment
- Next: dbt - Deployment
- Reference: Apply Sensitivity Level Tags (Project)
- See also: dbt - Artifacts, Replace the placeholders in the artifacts