The problem I’m having
I have 2 dbt projects I am working on.
In ProjectA , I have installed ProjectB as a package successfully.
I now want to reference a model from ProjectB inside a model from Project A using :
FROM {{ref(‘ProjectB’,‘model’)}}
The table that this ‘model’ has created lives inside B.B.model.
but when I run dbt, it tries to find the ‘model’ inside A.B.model which does not exist.
How can I get dbt to read FROM {{ref(‘ProjectB’,‘model’)}} correctly from the B.B.model rather than A.B.model?
The context of why I’m trying to do this
The rationale behind installing ProjectB as a package in ProjectA is to see all DAGs in one dbt lineage graph.
My company wants to go for a multi repo approach and I wanted to see if it was possible to reference another model built in ProjectB rather than using Source so we could truly see all dependencies clearly in our lineage graph.
What I’ve already tried
I have tried tweaking configurations inside the dbt_project.yml and schema.yml and profiles.yml files but I have not been successful (although I may be doing it wrong).
Some example code or error messages
PS C:\Users\DLy\dev\dbt_pam> dbt run --select Silver.HDS
22:56:10 Running with dbt=1.6.0
22:56:10 Registered adapter: snowflake=1.6.1
22:56:11 Unable to do partial parsing because a project config has changed
22:56:12 Found 112 models, 1 snapshot, 47 sources, 0 exposures, 0 metrics, 493 macros, 0 groups, 0 semantic models
22:56:12
22:56:21 Concurrency: 1 threads (target='dev')
22:56:21
22:56:21 1 of 2 START sql table model PAM.hds_attribute_data_1 .......................... [RUN]
22:56:22 1 of 2 ERROR creating sql table model PAM.hds_attribute_data_1 ................. [ERROR in 0.62s]
22:56:22 2 of 2 SKIP relation PAM.hds_attribute_data_3 .................................. [SKIP]
22:56:22
22:56:22 Finished running 2 table models in 0 hours 0 minutes and 9.96 seconds (9.96s).
22:56:22
22:56:22 Completed with 1 error and 0 warnings:
22:56:22
22:56:22 Database Error in model hds_attribute_data_1 (models\Silver\HDS\hds_attribute_data_1.sql)
22:56:22 002003 (02000): SQL compilation error:
22:56:22 Schema 'SILVER.HOMETRACK' does not exist or not authorized.
22:56:22 compiled Code at target\run\dbt_pam\models\Silver\HDS\hds_attribute_data_1.sql
22:56:22
22:56:22 Done. PASS=0 WARN=0 ERROR=1 SKIP=1 TOTAL=2
FROM {{ref('dbt_raw_base','hds_attribute_data_base')}} ##what I am using to reference the 'model' from ProjectB (package 'dbt_raw_base')
below is how dbt compiles the above, it should be looking for the ‘hds_attribute_data_base’ model/table inside the BASE.hometrack.hds_attribute_data_base
FROM SILVER.hometrack.hds_attribute_data_base