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

[CT-40] [Bug] Using state:modified.body returns NoneType object has no attribute raw_sql #4570

Closed
1 task done
rayhondo opened this issue Jan 13, 2022 · 3 comments · Fixed by #4631
Closed
1 task done
Labels
bug Something isn't working
Milestone

Comments

@rayhondo
Copy link

rayhondo commented Jan 13, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am trying to use the state:modified.body selector which is returning the following error:

'NoneType' object has no attribute 'raw_sql'

It appears to be struggling with identifying body changes when the model didn't previously exist as its not able to pull the raw_sql to reference.

Expected Behavior

The state:modified.body selector should return all models whose body changes OR didn't previously exist.

Steps To Reproduce

  1. Compile project
  2. Add an entirely new model
  3. Run dbt ls --select state:modified.body which yields this error message
[error] [MainThread]: Encountered an error:
'NoneType' object has no attribute 'raw_sql'

However, if I repeat the steps, but modify the intersection to be just state:modified, it returns the expected models.

Relevant log output

No response

Environment

- OS:  Darwin-20.6.0-x86_64-i386-64bit (Mac OS Big Sur 11.5.2)
- Python: 3.7.8
- dbt: 1.0.0

What database are you using dbt with?

snowflake

Additional Context

No response

@rayhondo rayhondo added bug Something isn't working triage labels Jan 13, 2022
@github-actions github-actions bot changed the title [Bug] Using state:modified.body returns 'NoneType' object has no attribute 'raw_sql' [CT-40] [Bug] Using state:modified.body returns NoneType object has no attribute raw_sql Jan 13, 2022
@jtcohen6 jtcohen6 added this to the v1.0.2 milestone Jan 14, 2022
@ChenyuLInx
Copy link
Contributor

ChenyuLInx commented Jan 20, 2022

Hey @rayhondo, I reproduced this on my side. Working on fixing it now and the target release is 1.0.2.
Just to confirm this happens only the first time you run dbt ls --select state:modified.body --state target/ after the new model is added correct? For me the first time I run this command I got the same error. But if I run this command again the second time error is gone and I got No nodes selected!. Like this:

(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:51  Encountered an error:
'NoneType' object has no attribute 'raw_sql'
(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:55  The selection criterion 'state:modified.body' does not match any nodes
22:56:55  No nodes selected!

@jtcohen6 jtcohen6 removed the triage label Jan 21, 2022
@rayhondo
Copy link
Author

Hey @rayhondo, I reproduced this on my side. Working on fixing it now and the target release is 1.0.2. Just to confirm this happens only the first time you run dbt ls --select state:modified.body --state target/ after the new model is added correct? For me the first time I run this command I got the same error. But if I run this command again the second time error is gone and I got No nodes selected!. Like this:

(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:51  Encountered an error:
'NoneType' object has no attribute 'raw_sql'
(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:55  The selection criterion 'state:modified.body' does not match any nodes
22:56:55  No nodes selected!

Yes, but that is undesired behavior since the body did change and was never picked up by the state:modified.body selector. We're using this in some "auto full refresh" automations and those tables would never get selected

@ChenyuLInx
Copy link
Contributor

Hey @rayhondo, I reproduced this on my side. Working on fixing it now and the target release is 1.0.2. Just to confirm this happens only the first time you run dbt ls --select state:modified.body --state target/ after the new model is added correct? For me the first time I run this command I got the same error. But if I run this command again the second time error is gone and I got No nodes selected!. Like this:

(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:51  Encountered an error:
'NoneType' object has no attribute 'raw_sql'
(env) ➜  toy dbt ls --select state:modified.body --state target/
22:56:55  The selection criterion 'state:modified.body' does not match any nodes
22:56:55  No nodes selected!

Yes, but that is undesired behavior since the body did change and was never picked up by the state:modified.body selector. We're using this in some "auto full refresh" automations and those tables would never get selected

Hi Ray, thanks for the context! I realized that manifest in target gets refreshed every time you run dbt ls. I have the fix now just need to add some tests before it goes in. I will keep you posted.

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

Successfully merging a pull request may close this issue.

3 participants