Here is how I formatted my dbt_project.yml
name: 'project_name'
version: '0.1.0'
config-version: 2
profile: 'project_name'
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]
target-path: "target"
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"
sources:
dbt_proj:
business-unit-x:
+database: "BUSINESS_UNIT_X_{{ env_var('SF_ENV')}}"
gold:
+schema: GOLD
silver:
+schema: SILVER
bronze:
+schema: BRONZE
Here is in example of a source, in the folder business-unit-x/silver:
version: 2
sources:
- name: I_DONT_WANT_TO_BE_USED_AS_SCHEMA
tables:
- name: table_name
columns:
- name: column_name
Is there an option to make DBT choose the schema in my dbt_project.yml instead of a schema or name property in my source ?
If not, how to configure the schema property to synchronize with the dbt_project.yml ?
According to this Issue comment there is no way of parsing jinja in the dbt_project
file.
So your best option may be
version: 2
sources:
- name: <source_name>
database: "BUSINESS_UNIT_X_{{ env_var('SF_ENV')}}"
tables:
- name: <table_name>
- ...