-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
bugSomething isn't workingSomething isn't workingsnapshotsIssues related to dbt's snapshot functionalityIssues related to dbt's snapshot functionalitystaleIssues that have gone staleIssues that have gone staletriage
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
Snapshots defined in a yaml file such as dbt_project/models/schema.yml fail to build/run if a file dbt_project/target/run/dbt_project/models/schema.yml exists:
Unhandled error while executing target/run/dbt_project/models/schema.yml/schema.yml/snapshot.sql
[Errno 20] Not a directory: 'dbt_project/target/run/dbt_project/models/schema.yml/schema.yml'
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
- Replace
.with_in folder names, i.e.target/run/models/schema_yml/...- ideal because it's clearer than having folders with file extensions or - Check that item in target/run path is folder and handle gracefully (i.e. remove)
Steps To Reproduce
# dbt_project.yml
name: 'dbt_project'
profile: 'dbt_project'
model-paths: ["models"]
snapshot-paths: ["snapshots"]# models/schema.yml
snapshots:
- name: 'snapshot'
relation: ref('model')
config:
strategy: 'check'
unique_key: 'col'
check_cols: 'all'-- models/model.sql
SELECT 1 as coldbt build --select model
touch target/run/dbt_project/models/schema.yml
dbt build --select snapshotRelevant log output
$ dbt build --select snapshot
07:15:25 Running with dbt=1.9.2
07:15:25 Registered adapter: duckdb=1.9.2
07:15:25 Found 1 model, 1 snapshot, 426 macros
07:15:25
07:15:25 Concurrency: 1 threads (target='dev')
07:15:25
07:15:26 1 of 1 START snapshot main.snapshot ............................................ [RUN]
07:15:26 Unhandled error while executing target/run/dbt_project/models/schema.yml/schema.yml/snapshot.sql
[Errno 20] Not a directory: '~/dbt_project/target/run/dbt_project/models/schema.yml/schema.yml'
07:15:26 1 of 1 ERROR snapshotting main.snapshot ........................................ [ERROR in 0.25s]
07:15:26
07:15:26 Finished running 1 snapshot in 0 hours 0 minutes and 0.43 seconds (0.43s).
07:15:26
07:15:26 Completed with 1 error, 0 partial successes, and 0 warnings:
07:15:26
07:15:26 [Errno 20] Not a directory: '~/dbt_project/target/run/dbt_project/models/schema.yml/schema.yml'
07:15:26
07:15:26 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
Environment
- OS: Ubuntu 22.04.5
- Python: 3.12.7
- dbt: 1.9.2
- dbt-duckdb: 1.9.2Which 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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingsnapshotsIssues related to dbt's snapshot functionalityIssues related to dbt's snapshot functionalitystaleIssues that have gone staleIssues that have gone staletriage