Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Tests with configs in dbt_project.yml are triggering state:modified in 1.9 without any changes (when the deferred to state is from 1.7) #11146

Closed
2 tasks done
jeremyyeo opened this issue Dec 12, 2024 · 3 comments · Fixed by #11166
Assignees
Labels
backport 1.9.latest bug Something isn't working

Comments

@jeremyyeo
Copy link
Contributor

jeremyyeo commented Dec 12, 2024

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

Looks like there's a false positive if tests have any configs when users go from 1.7 to 1.9.

Expected Behavior

No false positive.

Steps To Reproduce

Project setup:

# dbt_project.yml
name: my_dbt_project
profile: all
config-version: 2
version: "1.0.0"

models:
  my_dbt_project:
    +materialized: table

tests:
  +store_failures: true

# models/schema.yml
version: 2
models:
  - name: foo
    columns:
      - name: id
        tests:
          - unique
-- models/foo.sql
select 1 id

First use dbt 1.7:

$ dbt build

21:25:22  Running with dbt=1.7.19
21:25:23  Registered adapter: snowflake=1.7.5
21:25:23  Unable to do partial parsing because saved manifest not found. Starting full parse.
21:25:23  Found 1 model, 1 test, 0 sources, 0 exposures, 0 metrics, 431 macros, 0 groups, 0 semantic models
21:25:23  
21:25:26  Concurrency: 1 threads (target='sf')
21:25:26  
21:25:26  1 of 2 START sql table model sch.foo ........................................... [RUN]
21:25:27  1 of 2 OK created sql table model sch.foo ...................................... [SUCCESS 1 in 0.89s]
21:25:27  2 of 2 START test unique_foo_id ................................................ [RUN]
21:25:28  2 of 2 PASS unique_foo_id ...................................................... [PASS in 1.53s]
21:25:29  
21:25:29  Finished running 1 table model, 1 test in 0 hours 0 minutes and 6.10 seconds (6.10s).
21:25:29  
21:25:29  Completed successfully
21:25:29  
21:25:29  Done. PASS=2 WARN=0 ERROR=0 SKIP=0 TOTAL=

$ mv target target_old

Don't change anything - switch over to 1.9.pre and do a defer run using the manifest above:

$ dbt build -s state:modified --defer --state target_old

21:25:51  Running with dbt=1.9.0-rc2
21:25:51  Registered adapter: snowflake=1.9.0-rc1
21:25:51  Unable to do partial parsing because saved manifest not found. Starting full parse.
21:25:52  Found 1 model, 1 test, 468 macros
21:25:52  
21:25:52  Concurrency: 1 threads (target='sf')
21:25:52  
21:25:55  1 of 1 START test unique_foo_id ................................................ [RUN]
21:25:56  1 of 1 PASS unique_foo_id ...................................................... [PASS in 1.63s]
21:25:57  
21:25:57  Finished running 1 test in 0 hours 0 minutes and 5.36 seconds (5.36s).
21:25:57  
21:25:57  Completed successfully
21:25:57  
21:25:57  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1

Relevant log output

No response

Environment

- OS: macOS
- Python: 3.11.9
- dbt: 1.9.0-rc2

Which database adapter are you using with dbt?

snowflake

Additional Context

This is not an issue if the deferred to state was from 1.8.

  • 1.8 > 1.9 no issue.
  • 1.7 > 1.9 issue.

This may be relevant too: #10322

@jeremyyeo jeremyyeo added bug Something isn't working triage labels Dec 12, 2024
@MichelleArk
Copy link
Contributor

Open question: does this also occur in 1.7 > 1.8 issue?

@ChenyuLInx
Copy link
Contributor

ChenyuLInx commented Dec 16, 2024

We should fix this, log the reason of what state if modified.
And create a follow up issue for more comprehensive state_modified reason logging.

@ChenyuLInx
Copy link
Contributor

if we need to touch Unrendered config it could get complicated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.9.latest bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants