From 4c02c07b95f8c1c582320558384a349e1d4fd51a Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:03:18 -0700 Subject: [PATCH] Update SQLQuery to include node_info (#936) * use dynamic schema in test_grant_access_to.py * use dynamic schema in test_grant_access_to.py * update SQLQuery to include node_info * add changie * revert setup --- .changes/unreleased/Under the Hood-20230922-114217.yaml | 6 ++++++ dbt/adapters/bigquery/connections.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Under the Hood-20230922-114217.yaml diff --git a/.changes/unreleased/Under the Hood-20230922-114217.yaml b/.changes/unreleased/Under the Hood-20230922-114217.yaml new file mode 100644 index 000000000..78fee33c4 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230922-114217.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: update SQLQuery to include node_info +time: 2023-09-22T11:42:17.770033-07:00 +custom: + Author: colin-rogers-dbt + Issue: "936" diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index 7799ecb8a..a5c7b9355 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -5,6 +5,7 @@ from contextlib import contextmanager from dataclasses import dataclass, field +from dbt.events.contextvars import get_node_info from mashumaro.helper import pass_through from functools import lru_cache @@ -444,7 +445,8 @@ def raw_execute( conn = self.get_thread_connection() client = conn.handle - fire_event(SQLQuery(conn_name=conn.name, sql=sql)) + fire_event(SQLQuery(conn_name=conn.name, sql=sql, node_info=get_node_info())) + if ( hasattr(self.profile, "query_comment") and self.profile.query_comment