[Bug] Seed properties .yml files compile twice and clash when seed directory is under model directory
mbarnathan-os opened this issue · 1 comments
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
When specifying seed properties via a .yml file and the seed-paths directory is under the model-paths directory, the .yml file will be compiled twice and dbt will error out with "dbt found two schema.yml entries for the same resource" against the same file, even though there is no actual duplication. This doesn't happen if the seed is defined solely by csv; i.e. the yml file is absent.
Expected Behavior
Nesting seeds under the model directory is a supported use case per the docs, so I would expect the model parsing phase to detect the duplication and omit the seed a second time.
Steps To Reproduce
- model-paths: ["models"]
- seed-paths: ["models/seeds"]
- Add a .yml file in the seed path with at least one seed
- Add a csv file for the seed
- dbt parse yields "dbt found two schema.yml entries for the same resource" with the seed yml from step 3
Relevant log output
No response
Environment
- OS:
- Python:
- dbt:
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
Thanks for reporting this @mbarnathan-os 👍
I was able to reproduce what you described. See details below.
Reprex
dbt_project.yml
name: "my_project"
version: "1.0.0"
config-version: 2
profile: "some_profile"
model-paths: ["models"]
seed-paths: ["models/seeds"]
mkdir -p models
mkdir -p models/seeds
Create a seed file:
cat <<EOF > models/seeds/my_seed.csv
id
1
EOF
Add an associated YAML file:
cat <<EOF > models/seeds/_seeds.yml
seeds:
- name: my_seed
EOF
See that it never works when partial parsing is disabled (but may work it certain situations when it is enabled):
dbt parse --no-partial-parse
dbt list --no-partial-parse
Side note
For me, I did an initial dbt parse
prior to adding the YAML file, and dbt commands worked as long as partial parsing was enabled and I didn't dbt clean
my partial parsing artifacts.