Skip to content

Commit 75fd5e8

Browse files
authored
Add missing poll_interval in Bigquery operator (#30132)
1 parent 85e8cca commit 75fd5e8

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

β€Žairflow/providers/google/cloud/operators/bigquery.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ class BigQueryCheckOperator(_BigQueryDbHookMixin, SQLCheckOperator):
177177
account from the list granting this role to the originating account (templated).
178178
:param labels: a dictionary containing labels for the table, passed to BigQuery
179179
:param deferrable: Run operator in the deferrable mode
180+
:param poll_interval: (Deferrable mode only) polling period in seconds to check for the status of job.
181+
Defaults to 4 seconds.
180182
"""
181183

182184
template_fields: Sequence[str] = (
@@ -198,6 +200,7 @@ def __init__(
198200
impersonation_chain: str | Sequence[str] | None = None,
199201
labels: dict | None = None,
200202
deferrable: bool = False,
203+
poll_interval: float = 4.0,
201204
**kwargs,
202205
) -> None:
203206
super().__init__(sql=sql, **kwargs)
@@ -208,6 +211,7 @@ def __init__(
208211
self.impersonation_chain = impersonation_chain
209212
self.labels = labels
210213
self.deferrable = deferrable
214+
self.poll_interval = poll_interval
211215

212216
def _submit_job(
213217
self,
@@ -240,6 +244,7 @@ def execute(self, context: Context):
240244
conn_id=self.gcp_conn_id,
241245
job_id=job.job_id,
242246
project_id=hook.project_id,
247+
poll_interval=self.poll_interval,
243248
),
244249
method_name="execute_complete",
245250
)
@@ -288,6 +293,8 @@ class BigQueryValueCheckOperator(_BigQueryDbHookMixin, SQLValueCheckOperator):
288293
account from the list granting this role to the originating account (templated).
289294
:param labels: a dictionary containing labels for the table, passed to BigQuery
290295
:param deferrable: Run operator in the deferrable mode
296+
:param poll_interval: (Deferrable mode only) polling period in seconds to check for the status of job.
297+
Defaults to 4 seconds.
291298
"""
292299

293300
template_fields: Sequence[str] = (
@@ -312,6 +319,7 @@ def __init__(
312319
impersonation_chain: str | Sequence[str] | None = None,
313320
labels: dict | None = None,
314321
deferrable: bool = False,
322+
poll_interval: float = 4.0,
315323
**kwargs,
316324
) -> None:
317325
super().__init__(sql=sql, pass_value=pass_value, tolerance=tolerance, **kwargs)
@@ -321,6 +329,7 @@ def __init__(
321329
self.impersonation_chain = impersonation_chain
322330
self.labels = labels
323331
self.deferrable = deferrable
332+
self.poll_interval = poll_interval
324333

325334
def _submit_job(
326335
self,
@@ -360,6 +369,7 @@ def execute(self, context: Context) -> None: # type: ignore[override]
360369
sql=self.sql,
361370
pass_value=self.pass_value,
362371
tolerance=self.tol,
372+
poll_interval=self.poll_interval,
363373
),
364374
method_name="execute_complete",
365375
)
@@ -414,6 +424,8 @@ class BigQueryIntervalCheckOperator(_BigQueryDbHookMixin, SQLIntervalCheckOperat
414424
account from the list granting this role to the originating account (templated).
415425
:param labels: a dictionary containing labels for the table, passed to BigQuery
416426
:param deferrable: Run operator in the deferrable mode
427+
:param poll_interval: (Deferrable mode only) polling period in seconds to check for the status of job.
428+
Defaults to 4 seconds.
417429
"""
418430

419431
template_fields: Sequence[str] = (
@@ -439,6 +451,7 @@ def __init__(
439451
impersonation_chain: str | Sequence[str] | None = None,
440452
labels: dict | None = None,
441453
deferrable: bool = False,
454+
poll_interval: float = 4.0,
442455
**kwargs,
443456
) -> None:
444457
super().__init__(
@@ -455,6 +468,7 @@ def __init__(
455468
self.impersonation_chain = impersonation_chain
456469
self.labels = labels
457470
self.deferrable = deferrable
471+
self.poll_interval = poll_interval
458472

459473
def _submit_job(
460474
self,
@@ -498,6 +512,7 @@ def execute(self, context: Context):
498512
days_back=self.days_back,
499513
ratio_formula=self.ratio_formula,
500514
ignore_zero=self.ignore_zero,
515+
poll_interval=self.poll_interval,
501516
),
502517
method_name="execute_complete",
503518
)
@@ -794,6 +809,8 @@ class BigQueryGetDataOperator(GoogleCloudBaseOperator):
794809
Service Account Token Creator IAM role to the directly preceding identity, with first
795810
account from the list granting this role to the originating account (templated).
796811
:param deferrable: Run operator in the deferrable mode
812+
:param poll_interval: (Deferrable mode only) polling period in seconds to check for the status of job.
813+
Defaults to 4 seconds.
797814
:param delegate_to: The account to impersonate using domain-wide delegation of authority,
798815
if any. For this to work, the service account making the request must have
799816
domain-wide delegation enabled. Deprecated.
@@ -822,6 +839,7 @@ def __init__(
822839
impersonation_chain: str | Sequence[str] | None = None,
823840
deferrable: bool = False,
824841
delegate_to: str | None = None,
842+
poll_interval: float = 4.0,
825843
**kwargs,
826844
) -> None:
827845
super().__init__(**kwargs)
@@ -840,6 +858,7 @@ def __init__(
840858
self.impersonation_chain = impersonation_chain
841859
self.project_id = project_id
842860
self.deferrable = deferrable
861+
self.poll_interval = poll_interval
843862

844863
def _submit_job(
845864
self,
@@ -915,6 +934,7 @@ def execute(self, context: Context):
915934
dataset_id=self.dataset_id,
916935
table_id=self.table_id,
917936
project_id=hook.project_id,
937+
poll_interval=self.poll_interval,
918938
),
919939
method_name="execute_complete",
920940
)
@@ -2630,7 +2650,8 @@ class BigQueryInsertJobOperator(GoogleCloudBaseOperator):
26302650
:param result_retry: How to retry the `result` call that retrieves rows
26312651
:param result_timeout: The number of seconds to wait for `result` method before using `result_retry`
26322652
:param deferrable: Run operator in the deferrable mode
2633-
:param poll_interval: polling period in seconds to check for the status of job. Defaults to 4 seconds.
2653+
:param poll_interval: (Deferrable mode only) polling period in seconds to check for the status of job.
2654+
Defaults to 4 seconds.
26342655
"""
26352656

26362657
template_fields: Sequence[str] = (

0 commit comments

Comments
 (0)