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

Add bytes_billed to BigQueryAdapterResponse #570

Merged
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/Features-20230228-094234.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: 'Adding `bytes_billed` to `BigQueryAdapterResponse` '
time: 2023-02-28T09:42:34.557696-03:00
custom:
Author: bruno-szdl
Issue: "560"
4 changes: 4 additions & 0 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class BigQueryConnectionMethod(StrEnum):
@dataclass
class BigQueryAdapterResponse(AdapterResponse):
bytes_processed: Optional[int] = None
bytes_billed: Optional[int] = None
location: Optional[str] = None
project_id: Optional[str] = None
job_id: Optional[str] = None
Expand Down Expand Up @@ -471,6 +472,7 @@ def execute(
code = None
num_rows = None
bytes_processed = None
bytes_billed = None
location = None
job_id = None
project_id = None
Expand Down Expand Up @@ -505,6 +507,7 @@ def execute(

# set common attributes
bytes_processed = query_job.total_bytes_processed
bytes_billed = query_job.total_bytes_billed
slot_ms = query_job.slot_millis
processed_bytes = self.format_bytes(bytes_processed)
location = query_job.location
Expand All @@ -526,6 +529,7 @@ def execute(
rows_affected=num_rows,
code=code,
bytes_processed=bytes_processed,
bytes_billed=bytes_billed,
location=location,
project_id=project_id,
job_id=job_id,
Expand Down