File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ def _export_gbq(
320320
321321 # TODO(swast): plumb through the api_name of the user-facing api that
322322 # caused this query.
323- iterator , _ = self ._run_execute_query (
323+ iterator , job = self ._run_execute_query (
324324 sql = sql ,
325325 job_config = job_config ,
326326 )
@@ -338,7 +338,9 @@ def _export_gbq(
338338
339339 return executor .EmptyExecuteResult (
340340 bf_schema = array_value .schema ,
341- execution_metadata = executor .ExecutionMetadata .from_iterator (iterator ),
341+ execution_metadata = executor .ExecutionMetadata .from_iterator_and_job (
342+ iterator , job
343+ ),
342344 )
343345
344346 def dry_run (
@@ -681,7 +683,9 @@ def _execute_plan_gbq(
681683 assert compiled .row_order is not None
682684 self .cache .cache_results_table (og_plan , result_bq_data )
683685
684- execution_metadata = executor .ExecutionMetadata .from_iterator (iterator )
686+ execution_metadata = executor .ExecutionMetadata .from_iterator_and_job (
687+ iterator , query_job
688+ )
685689 if result_bq_data is not None :
686690 return executor .BQTableExecuteResult (
687691 data = result_bq_data ,
Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ def execute(
6868 return executor .LocalExecuteResult (
6969 data = iterator .to_arrow (),
7070 bf_schema = plan .schema ,
71- execution_metadata = executor .ExecutionMetadata .from_iterator (iterator ),
71+ execution_metadata = executor .ExecutionMetadata .from_iterator_and_job (
72+ iterator , query_job
73+ ),
7274 )
7375
7476 def _run_execute_query (
Original file line number Diff line number Diff line change @@ -171,10 +171,10 @@ class ExecutionMetadata:
171171 bytes_processed : Optional [int ] = None
172172
173173 @classmethod
174- def from_iterator ( cls , iterator : bq_table . RowIterator ) -> ExecutionMetadata :
175- return cls (
176- query_job = iterator . query , bytes_processed = iterator . total_bytes_processed
177- )
174+ def from_iterator_and_job (
175+ cls , iterator : bq_table . RowIterator , job : Optional [ bigquery . QueryJob ]
176+ ) -> ExecutionMetadata :
177+ return cls ( query_job = job , bytes_processed = iterator . total_bytes_processed )
178178
179179
180180class LocalExecuteResult (ExecuteResult ):
You can’t perform that action at this time.
0 commit comments