Closed
Description
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Very similar to #8327
When:
- a model with the same name is defined in multiple projects
- those projects are installed in the same runtime environment (via packages)
- at least one of those models has a version defined
dbt raises an ambiguous reference error
Expected Behavior
dbt should successfully parse my project, and resolve version definitions to reference the model in the same project/package where they are defined
Steps To Reproduce
Create a project named my_dbt_project
, and another local project under a subdirectory named mypkg/
.
Within the root project:
# dbt_project.yml
name: my_dbt_project
profile: default
# dependencies.yml OR packages.yml
packages:
- local: mypkg
-- models/model_a.sql
select 1 as id
# models/config.yml
models:
- name: model_a
versions:
- v: 1
Within the package mypkg
, add the exact same model with the exact same config:
# mypkg/dbt_project.yml
name: mypkg
-- mypkg/models/model_a.sql
select 1 as id
# mypkg/models/config.yml
models:
- name: model_a
versions:
- v: 1
From the root project:
$ dbt deps
14:10:31 Running with dbt=1.6.0
14:10:31 Installing mypkg
14:10:31 Installed from <local @ mypkg>
$ dbt --no-partial-parse parse
14:10:43 Running with dbt=1.6.0
14:10:43 Registered adapter: postgres=1.6.0
14:10:44 Encountered an error:
Compilation Error
When referencing 'model_a', dbt found nodes in multiple packages: 'model.my_dbt_project.model_a', 'model.mypkg.model_a'
To fix this, use two-argument 'ref', with the package name first: 'my_dbt_project' or 'mypkg'
Remove the unique
tests, then parse again (this time successfully):
$ dbt --no-partial-parse parse
14:11:23 Running with dbt=1.6.0
14:11:24 Registered adapter: postgres=1.6.0
14:11:24 Performance info: /Users/jerco/dev/scratch/testy/target/perf_info.json
Environment
- OS: macOS Ventura 13.4.1
- Python: 3.10.11
- dbt: 1.6.0
Relevant log output
No response
Environment
- OS:
- Python:
- dbt:
Which database adapter are you using with dbt?
No response
Additional Context
No response
Activity