I am trying to reference a src.yml
in a model within a folder
here is the structure
- dataservice- dbt_model- models- my_folder- model_1.sql- src.yml- dbt_project.yml
the src.yml
version: 2sources:- name: Greenschema: HistoryGreentables:- name: trans
I tried using the codes below but they didn't work
select * FROM {{ ref ('Green', 'trans') }}select * FROM {{ source ('Green', 'trans') }}
Best Answer
DBT does not yet support namespacing, so all DBT sources and models are universally scoped. You can ref
or source
from any model regardless of where the .yml
file is located in your directory structure and you can refer to it as if it were in the same directory as your model. The only requirements are that the names have to be unique across all config files and they must be under a sub-directory specified in your model-paths
configuration in dbt_project.yml
. It doesn't look like you have your full project directory structure posted, but if dataservice
is not under models/
(which is the default value in model-paths
), then it won't be able to find your source ymls.