diff --git a/.changes/unreleased/Under the Hood-20230727-223848.yaml b/.changes/unreleased/Under the Hood-20230727-223848.yaml new file mode 100644 index 000000000..8aa19a7d3 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230727-223848.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Use execute instead of raw execute to add the query comment as query header +time: 2023-07-27T22:38:48.258012+02:00 +custom: + Author: Kayrnt + Issue: "808" diff --git a/dbt/adapters/bigquery/impl.py b/dbt/adapters/bigquery/impl.py index 50ce21f11..9b8f5a112 100644 --- a/dbt/adapters/bigquery/impl.py +++ b/dbt/adapters/bigquery/impl.py @@ -399,7 +399,7 @@ def get_column_schema_from_query(self, sql: str) -> List[BigQueryColumn]: :param str sql: The sql to execute. :return: List[BigQueryColumn] """ - _, iterator = self.connections.raw_execute(sql) + _, iterator = self.connections.execute(sql) columns = [self.Column.create_from_field(field) for field in iterator.schema] flattened_columns = [] for column in columns: @@ -411,7 +411,7 @@ def get_columns_in_select_sql(self, select_sql: str) -> List[BigQueryColumn]: try: conn = self.connections.get_thread_connection() client = conn.handle - query_job, iterator = self.connections.raw_execute(select_sql) + query_job, iterator = self.connections.execute(select_sql) query_table = client.get_table(query_job.destination) return self._get_dbt_columns_from_bq_table(query_table)