Skip to content

Commit

Permalink
Add bytes_billed to BigQueryAdapterResponse (#570)
Browse files Browse the repository at this point in the history
* adding bytes_billed to adapter response

* adding changie

---------

Co-authored-by: Florian Eiden <florian.eiden@fleid.fr>
Co-authored-by: Matthew McKnight <91097623+McKnight-42@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 20, 2023
1 parent 43842bf commit 1cb3c7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit 1cb3c7c

Please sign in to comment.