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

'NoneType' object has no attribute 'job_label' #3314

Closed
QPeiran opened this issue May 4, 2021 · 8 comments · Fixed by #3351
Closed

'NoneType' object has no attribute 'job_label' #3314

QPeiran opened this issue May 4, 2021 · 8 comments · Fixed by #3351
Assignees
Labels
bug Something isn't working
Milestone

Comments

@QPeiran
Copy link

QPeiran commented May 4, 2021

I am trying to configure the bigquery connection profile. Somehow get the following error message after "dbt debug".

'NoneType' object has no attribute 'job_label'

Not sure how to debug this. Can someone give me a hint please?
image

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 4, 2021

Hey @QPeiran, what version of dbt are you using? Are you able to run dbt --version?

@QPeiran
Copy link
Author

QPeiran commented May 4, 2021

Hi @jtcohen6 , the version I am using is 0.19.0
image

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 4, 2021

@QPeiran Ok, I appreciate you sharing that info. I'm not sure what's going on here. Could you try running a different command with debug-level logging:

$ dbt --debug run

Hopefully, this will print out a more detailed stacktrace, including a hint as to where the 'NoneType' object has no attribute 'job_label' message originates.

@QPeiran
Copy link
Author

QPeiran commented May 5, 2021

Hi @jtcohen6 , thank you for looking into this problem.
Here's the full log after --debug run:

2021-05-04 23:54:01.563985 (MainThread): Running with dbt=0.19.0
2021-05-04 23:54:02.396733 (MainThread): running dbt with arguments Namespace(record_timing_info=None, debug=True, log_format='default', write_json=True, use_colors=None, strict=False, warn_error=False, partial_parse=None, single_threaded=False, test_new_parser=False, project_dir=None, profiles_dir='C:\\Users\\PeiranQ\\.dbt', profile=None, target=None, vars='{}', log_cache_events=False, use_cache=True, fail_fast=False, threads=None, version_check=True, models=None, exclude=None, selector_name=None, state=None, defer=None, full_refresh=False, cls=<class 'dbt.task.run.RunTask'>, which='run', rpc_method='run')
2021-05-04 23:54:02.396733 (MainThread): Tracking: tracking
2021-05-04 23:54:02.411176 (MainThread): Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'start', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AC595760>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE167CA0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE167A00>]}
2021-05-04 23:54:02.439673 (MainThread): Partial parsing not enabled
2021-05-04 23:54:02.468677 (MainThread): Parsing macros\adapters.sql
2021-05-04 23:54:02.522676 (MainThread): Parsing macros\catalog.sql
2021-05-04 23:54:02.532678 (MainThread): Parsing macros\etc.sql
2021-05-04 23:54:02.535681 (MainThread): Parsing macros\materializations\copy.sql
2021-05-04 23:54:02.541678 (MainThread): Parsing macros\materializations\incremental.sql
2021-05-04 23:54:02.555679 (MainThread): Parsing macros\materializations\seed.sql    
2021-05-04 23:54:02.558679 (MainThread): Parsing macros\materializations\snapshot.sql
2021-05-04 23:54:02.560682 (MainThread): Parsing macros\materializations\table.sql   
2021-05-04 23:54:02.581678 (MainThread): Parsing macros\materializations\view.sql
2021-05-04 23:54:02.586681 (MainThread): Parsing macros\core.sql
2021-05-04 23:54:02.594678 (MainThread): Parsing macros\adapters\common.sql
2021-05-04 23:54:02.775685 (MainThread): Parsing macros\etc\datetime.sql
2021-05-04 23:54:02.785679 (MainThread): Parsing macros\etc\get_custom_alias.sql   
2021-05-04 23:54:02.786680 (MainThread): Parsing macros\etc\get_custom_database.sql
2021-05-04 23:54:02.788680 (MainThread): Parsing macros\etc\get_custom_schema.sql  
2021-05-04 23:54:02.792685 (MainThread): Parsing macros\etc\is_incremental.sql      
2021-05-04 23:54:02.794679 (MainThread): Parsing macros\etc\query.sql
2021-05-04 23:54:02.795683 (MainThread): Parsing macros\materializations\helpers.sql
2021-05-04 23:54:02.846685 (MainThread): Parsing macros\materializations\test.sql
2021-05-04 23:54:02.847684 (MainThread): Parsing macros\materializations\common\merge.sql
2021-05-04 23:54:02.865682 (MainThread): Parsing macros\materializations\incremental\helpers.sql    
2021-05-04 23:54:02.868681 (MainThread): Parsing macros\materializations\incremental\incremental.sql
2021-05-04 23:54:02.877681 (MainThread): Parsing macros\materializations\seed\seed.sql
2021-05-04 23:54:02.958683 (MainThread): Parsing macros\materializations\snapshot\snapshot.sql
2021-05-04 23:54:03.065685 (MainThread): Parsing macros\materializations\snapshot\snapshot_merge.sql
2021-05-04 23:54:03.069684 (MainThread): Parsing macros\materializations\snapshot\strategies.sql
2021-05-04 23:54:03.094684 (MainThread): Parsing macros\materializations\table\table.sql
2021-05-04 23:54:03.104685 (MainThread): Parsing macros\materializations\view\create_or_replace_view.sql
2021-05-04 23:54:03.160685 (MainThread): Parsing macros\materializations\view\view.sql
2021-05-04 23:54:03.188686 (MainThread): Parsing macros\schema_tests\accepted_values.sql
2021-05-04 23:54:03.194689 (MainThread): Parsing macros\schema_tests\not_null.sql
2021-05-04 23:54:03.196688 (MainThread): Parsing macros\schema_tests\relationships.sql
2021-05-04 23:54:03.199685 (MainThread): Parsing macros\schema_tests\unique.sql
2021-05-04 23:54:03.597695 (MainThread): Acquiring new bigquery connection "model.shop_Peiran.my_first_dbt_model".
2021-05-04 23:54:03.622020 (MainThread): Acquiring new bigquery connection "model.shop_Peiran.my_second_dbt_model".
2021-05-04 23:54:03.801025 (MainThread): Sending event: {'category': 'dbt', 'action': 'load_project', 'label': 'c7ccb26c-0fd4-4ee3-975e-208bbddcd51b', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE111670>]}
2021-05-04 23:54:03.843023 (MainThread): Sending event: {'category': 'dbt', 'action': 'resource_counts', 'label': 'c7ccb26c-0fd4-4ee3-975e-208bbddcd51b', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE25D550>]}
2021-05-04 23:54:03.852024 (MainThread): Found 2 models, 4 tests, 0 snapshots, 0 analyses, 161 macros, 0 operations, 0 seed files, 0 sources, 0 exposures
2021-05-04 23:54:03.864023 (MainThread):
2021-05-04 23:54:03.867023 (MainThread): Acquiring new bigquery connection "master".
2021-05-04 23:54:03.869023 (ThreadPoolExecutor-0_0): Acquiring new bigquery connection "list_dbt-bq".
2021-05-04 23:54:03.870024 (ThreadPoolExecutor-0_0): Opening a new connection, currently in state init
2021-05-04 23:54:08.116610 (ThreadPoolExecutor-1_0): Acquiring new bigquery connection "list_dbt-bq_dbt_peiran".
2021-05-04 23:54:08.116610 (ThreadPoolExecutor-1_0): Opening a new connection, currently in state init
2021-05-04 23:54:12.157205 (MainThread): 11:54:12 | Concurrency: 1 threads (target='dev')
2021-05-04 23:54:12.158205 (MainThread): 11:54:12 | 
2021-05-04 23:54:12.162203 (Thread-1): Began running node model.shop_Peiran.my_first_dbt_model
2021-05-04 23:54:12.163205 (Thread-1): 11:54:12 | 1 of 2 START table model dbt_peiran.my_first_dbt_model............... [RUN]
2021-05-04 23:54:12.164206 (Thread-1): Acquiring new bigquery connection "model.shop_Peiran.my_first_dbt_model".
2021-05-04 23:54:12.165208 (Thread-1): Compiling model.shop_Peiran.my_first_dbt_model
2021-05-04 23:54:12.168212 (Thread-1): Writing injected SQL for node "model.shop_Peiran.my_first_dbt_model"
2021-05-04 23:54:12.258208 (Thread-1): Opening a new connection, currently in state init
2021-05-04 23:54:16.225269 (Thread-1): Writing runtime SQL for node "model.shop_Peiran.my_first_dbt_model"
2021-05-04 23:54:16.240896 (Thread-1): On model.shop_Peiran.my_first_dbt_model: /* {"app": "dbt", "dbt_version": "0.19.0", "profile_name": "shop_Peiran", "target_name": "dev", "node_id": "model.shop_Peiran.my_first_dbt_model"} */


  create or replace table `dbt-bq`.`dbt_peiran`.`my_first_dbt_model`


  OPTIONS()
  as (
    /*
    Welcome to your first dbt model!
    Did you know that you can also configure models directly within SQL files?
    This will override configurations stated in dbt_project.yml

    Try changing "table" to "view" below
*/



with source_data as (

    select 1 as id
    union all
    select null as id

)

select *
from source_data

/*
    Uncomment the line below to remove records with null `id` values
*/

-- where id is not null
  );

2021-05-04 23:54:20.473153 (Thread-1): Sending event: {'category': 'dbt', 'action': 'run_model', 'label': 'c7ccb26c-0fd4-4ee3-975e-208bbddcd51b', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE2BCEB0>]}
2021-05-04 23:54:20.474150 (Thread-1): 11:54:20 | 1 of 2 OK created table model dbt_peiran.my_first_dbt_model.......... [CREATE TABLE (2.0 rows, 0.0 Bytes processed) in 8.31s]
2021-05-04 23:54:20.475151 (Thread-1): Finished running node model.shop_Peiran.my_first_dbt_model
2021-05-04 23:54:20.476151 (Thread-1): Began running node model.shop_Peiran.my_second_dbt_model
2021-05-04 23:54:20.477154 (Thread-1): 11:54:20 | 2 of 2 START view model dbt_peiran.my_second_dbt_model............... [RUN]
2021-05-04 23:54:20.478150 (Thread-1): Acquiring new bigquery connection "model.shop_Peiran.my_second_dbt_model".
2021-05-04 23:54:20.478150 (Thread-1): Compiling model.shop_Peiran.my_second_dbt_model
2021-05-04 23:54:20.482152 (Thread-1): Writing injected SQL for node "model.shop_Peiran.my_second_dbt_model"
2021-05-04 23:54:20.523154 (Thread-1): Writing runtime SQL for node "model.shop_Peiran.my_second_dbt_model"
2021-05-04 23:54:20.525154 (Thread-1): Opening a new connection, currently in state closed
2021-05-04 23:54:20.532152 (Thread-1): On model.shop_Peiran.my_second_dbt_model: /* {"app": "dbt", "dbt_version": "0.19.0", "profile_name": "shop_Peiran", "target_name": "dev", "node_id": "model.shop_Peiran.my_second_dbt_model"} */


  create or replace view `dbt-bq`.`dbt_peiran`.`my_second_dbt_model`
  OPTIONS()
  as -- Use the `ref` function to select from other models

select *
from `dbt-bq`.`dbt_peiran`.`my_first_dbt_model`
where id = 1;


2021-05-04 23:54:25.131186 (Thread-1): Sending event: {'category': 'dbt', 'action': 'run_model', 'label': 'c7ccb26c-0fd4-4ee3-975e-208bbddcd51b', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE2BCEB0>]}
2021-05-04 23:54:25.131186 (Thread-1): 11:54:25 | 2 of 2 OK created view model dbt_peiran.my_second_dbt_model.......... [OK in 4.65s]
2021-05-04 23:54:25.131186 (Thread-1): Finished running node model.shop_Peiran.my_second_dbt_model
2021-05-04 23:54:25.135718 (MainThread): Acquiring new bigquery connection "master".
2021-05-04 23:54:25.136732 (MainThread): 11:54:25 |
2021-05-04 23:54:25.137732 (MainThread): 11:54:25 | Finished running 1 table model, 1 view model in 21.27s.
2021-05-04 23:54:25.138732 (MainThread): Connection 'master' was properly closed.
2021-05-04 23:54:25.138732 (MainThread): Connection 'list_dbt-bq' was properly closed.
2021-05-04 23:54:25.139732 (MainThread): Connection 'list_dbt-bq_dbt_peiran' was properly closed.
2021-05-04 23:54:25.139732 (MainThread): Connection 'model.shop_Peiran.my_second_dbt_model' was properly closed.
2021-05-04 23:54:25.217730 (MainThread): 
2021-05-04 23:54:25.225734 (MainThread): Completed successfully
2021-05-04 23:54:25.262730 (MainThread): 
Done. PASS=2 WARN=0 ERROR=0 SKIP=0 TOTAL=2
2021-05-04 23:54:25.295732 (MainThread): Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE1196A0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE111670>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x000001A4AE25D4F0>]}
2021-05-04 23:54:25.299733 (MainThread): Flushing usage events

I can't see any error message from here but still get that 'NoneType' object has no attribute 'job_label' when dbt debug

@QPeiran
Copy link
Author

QPeiran commented May 5, 2021

Btw, I found by executing dbt --debug run, both example models are created successfully within Bigquery.
Meanwhile, I tested against using the snowflake and there is no error with dbt debug

(the difference could be for bigquery I am using the credentials generated by GCP service account, whereas the snowflake is using the username and password)

@mobuchowski
Copy link

mobuchowski commented May 5, 2021

I have the same error with bigquery and dbt 0.20.0b1, with project created from tutorial: https://docs.getdbt.com/tutorial/create-a-project-dbt-cli

Running with dbt=0.20.0-b1
dbt version: 0.20.0-b1
python version: 3.9.2
python path: /home/mobuchowski/tools/pyenv/versions/3.9.2/bin/python3.9
os info: Linux-5.11.0-16-generic-x86_64-with-glibc2.33
Using profiles.yml file at /home/mobuchowski/.dbt/profiles.yml
Using dbt_project.yml file at /home/mobuchowski/code/dbt-test/dbt_project.yml

Configuration:
  profiles.yml file [OK found and valid]
  dbt_project.yml file [OK found and valid]

Required dependencies:
 - git [OK found]

Connection:
  method: service-account
  database: speedy-vim-308516
  schema: dbt_alice
  location: EU
  priority: interactive
  timeout_seconds: 300
  maximum_bytes_billed: None
  Connection test: ERROR

dbt was unable to connect to the specified database.
The database returned the following error:

  >'NoneType' object has no attribute 'job_label'

Check your database credentials and try again. For more information, visit:
https://docs.getdbt.com/docs/configure-your-profile

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 5, 2021

Ah, this makes much more sense for v0.20.0-b1! We added a notion of query_comment.job_label in #3145.

In particular, I think it's the interaction between the debug task setting query_comment to None, and the dbt-bigquery connection expecting query_comment to be a dict with a property named job_label:

https://github.com/fishtown-analytics/dbt/blob/26fb58bd1b08218781b182918f5ed4dec3f735d9/core/dbt/task/debug.py#L65

https://github.com/fishtown-analytics/dbt/blob/26fb58bd1b08218781b182918f5ed4dec3f735d9/plugins/bigquery/dbt/adapters/bigquery/connections.py#L312

@jtcohen6 jtcohen6 added the bug Something isn't working label May 5, 2021
@jtcohen6 jtcohen6 added this to the Margaret Mead milestone May 5, 2021
@mobuchowski
Copy link

Yes, that makes sense. In particular, my shotgun debugging by inserting query-comment in random places in project and profile did not succeed 🙂

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.

4 participants