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

Use execute instead of raw execute to add the query comment as query header #846

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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:
Expand All @@ -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)

Expand Down