Skip to content

Commit

Permalink
Use execute instead of raw execute to add the query comment as query …
Browse files Browse the repository at this point in the history
…header
  • Loading branch information
Kayrnt committed Jul 27, 2023
1 parent 2bce977 commit 7322984
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20230727-223848.yaml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,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:
Expand All @@ -547,7 +547,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)

Expand Down

0 comments on commit 7322984

Please sign in to comment.