From c370d79dd803de06aad50cbba213090db8a1af73 Mon Sep 17 00:00:00 2001 From: Kyle Wigley Date: Wed, 12 May 2021 18:35:30 -0400 Subject: [PATCH] fix debug task for bigquery connections --- plugins/bigquery/dbt/adapters/bigquery/connections.py | 2 +- test/integration/049_dbt_debug_test/test_debug.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/bigquery/dbt/adapters/bigquery/connections.py b/plugins/bigquery/dbt/adapters/bigquery/connections.py index e0140c38c01..137b02d4f48 100644 --- a/plugins/bigquery/dbt/adapters/bigquery/connections.py +++ b/plugins/bigquery/dbt/adapters/bigquery/connections.py @@ -309,7 +309,7 @@ def raw_execute(self, sql, fetch=False, *, use_legacy_sql=False): logger.debug('On {}: {}', conn.name, sql) - if self.profile.query_comment.job_label: + if self.profile.query_comment and self.profile.query_comment.job_label: query_comment = self.query_header.comment.query_comment labels = self._labels_from_query_comment(query_comment) else: diff --git a/test/integration/049_dbt_debug_test/test_debug.py b/test/integration/049_dbt_debug_test/test_debug.py index 8a5fbd774f3..74fabfcbc7b 100644 --- a/test/integration/049_dbt_debug_test/test_debug.py +++ b/test/integration/049_dbt_debug_test/test_debug.py @@ -64,6 +64,11 @@ def test_postgres_ok(self): self.run_dbt(['debug']) self.assertNotIn('ERROR', self.capsys.readouterr().out) + @use_profile('bigquery') + def test_bigquery_ok(self): + self.run_dbt(['debug']) + self.assertNotIn('ERROR', self.capsys.readouterr().out) + @use_profile('postgres') def test_postgres_nopass(self): self.run_dbt(['debug', '--target', 'nopass'], expect_pass=False)