Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit 9b09fdb

Browse files
committed
simplify logic
1 parent bdffe92 commit 9b09fdb

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

pandas_gbq/gbq_connector.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,24 +245,14 @@ def run_query(
245245
timeout_ms=timeout_ms,
246246
)
247247

248-
dtypes = kwargs.get("dtypes")
249-
250248
if dry_run:
251-
# Access total_bytes_processed from the QueryJob via RowIterator.job
252-
# RowIterator has a job attribute that references the QueryJob
253-
if hasattr(rows_iter, "job") and rows_iter.job:
254-
return dry_runs.get_query_stats(rows_iter.job)
255-
256-
# Fallback: if query_and_wait_via_client_library doesn't set job,
257-
# we need to get it from the query result
258-
# For query_and_wait_via_client_library, the RowIterator should have job set
259-
raise ValueError("Cannot access QueryJob from RowIterator for dry_run")
249+
return dry_runs.get_query_stats(rows_iter.job)
260250

261251
return self._download_results(
262252
rows_iter,
263253
max_results=max_results,
264254
progress_bar_type=progress_bar_type,
265-
user_dtypes=dtypes,
255+
user_dtypes=kwargs.get("dtypes"),
266256
)
267257

268258
def _download_results(

0 commit comments

Comments
 (0)