-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Bug] Snapshots defined in yaml fail if yaml file exists in target/run directory #11321
Comments
For these yml models dbt-core/core/dbt/contracts/graph/nodes.py Lines 251 to 271 in e60b41d
This seems pretty inelegant, a path such as Adding this elif does this - although it probably needs to be more robust. if os.path.basename(self.path) == os.path.basename(self.original_file_path):
# One-to-one relationship of nodes to files.
path = self.original_file_path
elif os.path.dirname(self.path) == os.path.basename(self.original_file_path):
parent_dirname = os.path.dirname(self.original_file_path)
dirname = os.path.dirname(self.path).replace(".", "_")
basename = os.path.basename(self.path)
path = os.path.join(parent_dirname, dirname, basename)
else:
# Many-to-one relationship of nodes to files.
path = os.path.join(self.original_file_path, self.path) The resultant structure is much easier to understand:
|
Is this a new bug in dbt-core?
Current Behavior
Snapshots defined in a yaml file such as
dbt_project/models/schema.yml
fail to build/run if a filedbt_project/target/run/dbt_project/models/schema.yml
exists:I'm not sure exactly what causes the schema.yml to end up in the target directory, but it has happened multiple times.
Expected Behavior
.
with_
in folder names, i.e.target/run/models/schema_yml/...
- ideal because it's clearer than having folders with file extensions orSteps To Reproduce
Relevant log output
Environment
Which database adapter are you using with dbt?
Reproduced with duckdb and snowflake
Additional Context
If not already known - I'll look at fixing myself and making PR
The text was updated successfully, but these errors were encountered: