apache-airflow-providers-google 15.1.0rc1__py3-none-any.whl → 19.1.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. airflow/providers/google/3rd-party-licenses/NOTICE +2 -12
  2. airflow/providers/google/__init__.py +3 -3
  3. airflow/providers/google/ads/hooks/ads.py +39 -5
  4. airflow/providers/google/ads/operators/ads.py +2 -2
  5. airflow/providers/google/ads/transfers/ads_to_gcs.py +2 -2
  6. airflow/providers/google/assets/gcs.py +1 -11
  7. airflow/providers/google/cloud/bundles/__init__.py +16 -0
  8. airflow/providers/google/cloud/bundles/gcs.py +161 -0
  9. airflow/providers/google/cloud/hooks/bigquery.py +166 -281
  10. airflow/providers/google/cloud/hooks/cloud_composer.py +287 -14
  11. airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
  12. airflow/providers/google/cloud/hooks/cloud_run.py +17 -9
  13. airflow/providers/google/cloud/hooks/cloud_sql.py +101 -22
  14. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +27 -6
  15. airflow/providers/google/cloud/hooks/compute_ssh.py +5 -1
  16. airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
  17. airflow/providers/google/cloud/hooks/dataflow.py +71 -94
  18. airflow/providers/google/cloud/hooks/datafusion.py +1 -1
  19. airflow/providers/google/cloud/hooks/dataplex.py +1 -1
  20. airflow/providers/google/cloud/hooks/dataprep.py +1 -1
  21. airflow/providers/google/cloud/hooks/dataproc.py +72 -71
  22. airflow/providers/google/cloud/hooks/gcs.py +111 -14
  23. airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
  24. airflow/providers/google/cloud/hooks/kubernetes_engine.py +2 -2
  25. airflow/providers/google/cloud/hooks/looker.py +6 -1
  26. airflow/providers/google/cloud/hooks/mlengine.py +3 -2
  27. airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
  28. airflow/providers/google/cloud/hooks/spanner.py +73 -8
  29. airflow/providers/google/cloud/hooks/stackdriver.py +10 -8
  30. airflow/providers/google/cloud/hooks/translate.py +1 -1
  31. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +0 -209
  32. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +2 -2
  33. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +27 -1
  34. airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
  35. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
  36. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
  37. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
  38. airflow/providers/google/cloud/hooks/vision.py +2 -2
  39. airflow/providers/google/cloud/hooks/workflows.py +1 -1
  40. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  41. airflow/providers/google/cloud/links/base.py +77 -13
  42. airflow/providers/google/cloud/links/bigquery.py +0 -47
  43. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  44. airflow/providers/google/cloud/links/bigtable.py +0 -48
  45. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  46. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  47. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  48. airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
  49. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  50. airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -44
  51. airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
  52. airflow/providers/google/cloud/links/compute.py +0 -58
  53. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  54. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  55. airflow/providers/google/cloud/links/dataflow.py +0 -34
  56. airflow/providers/google/cloud/links/dataform.py +0 -64
  57. airflow/providers/google/cloud/links/datafusion.py +1 -96
  58. airflow/providers/google/cloud/links/dataplex.py +0 -154
  59. airflow/providers/google/cloud/links/dataprep.py +0 -24
  60. airflow/providers/google/cloud/links/dataproc.py +11 -95
  61. airflow/providers/google/cloud/links/datastore.py +0 -31
  62. airflow/providers/google/cloud/links/kubernetes_engine.py +9 -60
  63. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  64. airflow/providers/google/cloud/links/mlengine.py +0 -70
  65. airflow/providers/google/cloud/links/pubsub.py +0 -32
  66. airflow/providers/google/cloud/links/spanner.py +0 -33
  67. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  68. airflow/providers/google/cloud/links/translate.py +17 -187
  69. airflow/providers/google/cloud/links/vertex_ai.py +28 -195
  70. airflow/providers/google/cloud/links/workflows.py +0 -52
  71. airflow/providers/google/cloud/log/gcs_task_handler.py +17 -9
  72. airflow/providers/google/cloud/log/stackdriver_task_handler.py +9 -6
  73. airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
  74. airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
  75. airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
  76. airflow/providers/google/cloud/openlineage/facets.py +102 -1
  77. airflow/providers/google/cloud/openlineage/mixins.py +10 -8
  78. airflow/providers/google/cloud/openlineage/utils.py +15 -1
  79. airflow/providers/google/cloud/operators/alloy_db.py +70 -55
  80. airflow/providers/google/cloud/operators/bigquery.py +73 -636
  81. airflow/providers/google/cloud/operators/bigquery_dts.py +3 -5
  82. airflow/providers/google/cloud/operators/bigtable.py +36 -7
  83. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  84. airflow/providers/google/cloud/operators/cloud_batch.py +2 -2
  85. airflow/providers/google/cloud/operators/cloud_build.py +75 -32
  86. airflow/providers/google/cloud/operators/cloud_composer.py +128 -40
  87. airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
  88. airflow/providers/google/cloud/operators/cloud_memorystore.py +69 -43
  89. airflow/providers/google/cloud/operators/cloud_run.py +23 -5
  90. airflow/providers/google/cloud/operators/cloud_sql.py +8 -16
  91. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +92 -11
  92. airflow/providers/google/cloud/operators/compute.py +8 -40
  93. airflow/providers/google/cloud/operators/datacatalog.py +157 -21
  94. airflow/providers/google/cloud/operators/dataflow.py +38 -15
  95. airflow/providers/google/cloud/operators/dataform.py +15 -5
  96. airflow/providers/google/cloud/operators/datafusion.py +41 -20
  97. airflow/providers/google/cloud/operators/dataplex.py +193 -109
  98. airflow/providers/google/cloud/operators/dataprep.py +1 -5
  99. airflow/providers/google/cloud/operators/dataproc.py +78 -35
  100. airflow/providers/google/cloud/operators/dataproc_metastore.py +96 -88
  101. airflow/providers/google/cloud/operators/datastore.py +22 -6
  102. airflow/providers/google/cloud/operators/dlp.py +6 -29
  103. airflow/providers/google/cloud/operators/functions.py +16 -7
  104. airflow/providers/google/cloud/operators/gcs.py +10 -8
  105. airflow/providers/google/cloud/operators/gen_ai.py +389 -0
  106. airflow/providers/google/cloud/operators/kubernetes_engine.py +60 -99
  107. airflow/providers/google/cloud/operators/looker.py +1 -1
  108. airflow/providers/google/cloud/operators/managed_kafka.py +107 -52
  109. airflow/providers/google/cloud/operators/natural_language.py +1 -1
  110. airflow/providers/google/cloud/operators/pubsub.py +60 -14
  111. airflow/providers/google/cloud/operators/spanner.py +25 -12
  112. airflow/providers/google/cloud/operators/speech_to_text.py +1 -2
  113. airflow/providers/google/cloud/operators/stackdriver.py +1 -9
  114. airflow/providers/google/cloud/operators/tasks.py +1 -12
  115. airflow/providers/google/cloud/operators/text_to_speech.py +1 -2
  116. airflow/providers/google/cloud/operators/translate.py +40 -16
  117. airflow/providers/google/cloud/operators/translate_speech.py +1 -2
  118. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +39 -19
  119. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +29 -9
  120. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +54 -26
  121. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +70 -8
  122. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +43 -9
  123. airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
  124. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
  125. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -116
  126. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +11 -9
  127. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +57 -11
  128. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +30 -7
  129. airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
  130. airflow/providers/google/cloud/operators/video_intelligence.py +1 -1
  131. airflow/providers/google/cloud/operators/vision.py +2 -2
  132. airflow/providers/google/cloud/operators/workflows.py +18 -15
  133. airflow/providers/google/cloud/sensors/bigquery.py +2 -2
  134. airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -2
  135. airflow/providers/google/cloud/sensors/bigtable.py +11 -4
  136. airflow/providers/google/cloud/sensors/cloud_composer.py +533 -29
  137. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -2
  138. airflow/providers/google/cloud/sensors/dataflow.py +26 -9
  139. airflow/providers/google/cloud/sensors/dataform.py +2 -2
  140. airflow/providers/google/cloud/sensors/datafusion.py +4 -4
  141. airflow/providers/google/cloud/sensors/dataplex.py +2 -2
  142. airflow/providers/google/cloud/sensors/dataprep.py +2 -2
  143. airflow/providers/google/cloud/sensors/dataproc.py +2 -2
  144. airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -2
  145. airflow/providers/google/cloud/sensors/gcs.py +4 -4
  146. airflow/providers/google/cloud/sensors/looker.py +2 -2
  147. airflow/providers/google/cloud/sensors/pubsub.py +4 -4
  148. airflow/providers/google/cloud/sensors/tasks.py +2 -2
  149. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -2
  150. airflow/providers/google/cloud/sensors/workflows.py +2 -2
  151. airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
  152. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
  153. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -2
  154. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
  155. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +4 -4
  156. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
  157. airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
  158. airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
  159. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
  160. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  161. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +2 -2
  162. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +3 -3
  163. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +20 -12
  164. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -2
  165. airflow/providers/google/cloud/transfers/gcs_to_local.py +5 -3
  166. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +10 -4
  167. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
  168. airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
  169. airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
  170. airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
  171. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
  172. airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
  173. airflow/providers/google/cloud/transfers/postgres_to_gcs.py +42 -9
  174. airflow/providers/google/cloud/transfers/s3_to_gcs.py +12 -6
  175. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
  176. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +13 -4
  177. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
  178. airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
  179. airflow/providers/google/cloud/triggers/bigquery.py +75 -34
  180. airflow/providers/google/cloud/triggers/cloud_build.py +1 -1
  181. airflow/providers/google/cloud/triggers/cloud_composer.py +302 -46
  182. airflow/providers/google/cloud/triggers/cloud_run.py +2 -2
  183. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +91 -1
  184. airflow/providers/google/cloud/triggers/dataflow.py +122 -0
  185. airflow/providers/google/cloud/triggers/datafusion.py +1 -1
  186. airflow/providers/google/cloud/triggers/dataplex.py +14 -2
  187. airflow/providers/google/cloud/triggers/dataproc.py +122 -52
  188. airflow/providers/google/cloud/triggers/kubernetes_engine.py +45 -27
  189. airflow/providers/google/cloud/triggers/mlengine.py +1 -1
  190. airflow/providers/google/cloud/triggers/pubsub.py +15 -19
  191. airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
  192. airflow/providers/google/cloud/utils/credentials_provider.py +1 -1
  193. airflow/providers/google/cloud/utils/field_validator.py +1 -2
  194. airflow/providers/google/common/auth_backend/google_openid.py +4 -4
  195. airflow/providers/google/common/deprecated.py +2 -1
  196. airflow/providers/google/common/hooks/base_google.py +27 -8
  197. airflow/providers/google/common/links/storage.py +0 -22
  198. airflow/providers/google/common/utils/get_secret.py +31 -0
  199. airflow/providers/google/common/utils/id_token_credentials.py +3 -4
  200. airflow/providers/google/firebase/operators/firestore.py +2 -2
  201. airflow/providers/google/get_provider_info.py +56 -52
  202. airflow/providers/google/go_module_utils.py +35 -3
  203. airflow/providers/google/leveldb/hooks/leveldb.py +26 -1
  204. airflow/providers/google/leveldb/operators/leveldb.py +2 -2
  205. airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
  206. airflow/providers/google/marketing_platform/links/analytics_admin.py +5 -14
  207. airflow/providers/google/marketing_platform/operators/analytics_admin.py +1 -2
  208. airflow/providers/google/marketing_platform/operators/campaign_manager.py +5 -5
  209. airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
  210. airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
  211. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
  212. airflow/providers/google/marketing_platform/sensors/display_video.py +3 -63
  213. airflow/providers/google/suite/hooks/calendar.py +1 -1
  214. airflow/providers/google/suite/hooks/sheets.py +15 -1
  215. airflow/providers/google/suite/operators/sheets.py +8 -3
  216. airflow/providers/google/suite/sensors/drive.py +2 -2
  217. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -2
  218. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  219. airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
  220. airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
  221. airflow/providers/google/version_compat.py +15 -1
  222. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/METADATA +92 -48
  223. apache_airflow_providers_google-19.1.0rc1.dist-info/RECORD +331 -0
  224. apache_airflow_providers_google-19.1.0rc1.dist-info/licenses/NOTICE +5 -0
  225. airflow/providers/google/cloud/hooks/automl.py +0 -673
  226. airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
  227. airflow/providers/google/cloud/links/automl.py +0 -193
  228. airflow/providers/google/cloud/operators/automl.py +0 -1362
  229. airflow/providers/google/cloud/operators/life_sciences.py +0 -119
  230. airflow/providers/google/cloud/operators/mlengine.py +0 -112
  231. apache_airflow_providers_google-15.1.0rc1.dist-info/RECORD +0 -321
  232. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/WHEEL +0 -0
  233. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/entry_points.txt +0 -0
  234. {airflow/providers/google → apache_airflow_providers_google-19.1.0rc1.dist-info/licenses}/LICENSE +0 -0
@@ -19,12 +19,13 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
- from collections.abc import Sequence
22
+ from collections.abc import Callable, Sequence
23
23
  from functools import cached_property
24
- from typing import TYPE_CHECKING, Any, Callable
24
+ from typing import TYPE_CHECKING, Any
25
25
 
26
26
  from airflow.configuration import conf
27
27
  from airflow.exceptions import AirflowException
28
+ from airflow.providers.common.compat.sdk import BaseSensorOperator, PokeReturnValue
28
29
  from airflow.providers.google.cloud.hooks.dataflow import (
29
30
  DEFAULT_DATAFLOW_LOCATION,
30
31
  DataflowHook,
@@ -37,10 +38,9 @@ from airflow.providers.google.cloud.triggers.dataflow import (
37
38
  DataflowJobStatusTrigger,
38
39
  )
39
40
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
40
- from airflow.sensors.base import BaseSensorOperator
41
41
 
42
42
  if TYPE_CHECKING:
43
- from airflow.utils.context import Context
43
+ from airflow.providers.common.compat.sdk import Context
44
44
 
45
45
 
46
46
  class DataflowJobStatusSensor(BaseSensorOperator):
@@ -342,7 +342,7 @@ class DataflowJobMessagesSensor(BaseSensorOperator):
342
342
  self.deferrable = deferrable
343
343
  self.poll_interval = poll_interval
344
344
 
345
- def poke(self, context: Context) -> bool:
345
+ def poke(self, context: Context) -> PokeReturnValue | bool:
346
346
  if self.fail_on_terminal_state:
347
347
  job = self.hook.get_job(
348
348
  job_id=self.job_id,
@@ -359,8 +359,17 @@ class DataflowJobMessagesSensor(BaseSensorOperator):
359
359
  project_id=self.project_id,
360
360
  location=self.location,
361
361
  )
362
+ result = result if self.callback is None else self.callback(result)
363
+
364
+ if isinstance(result, PokeReturnValue):
365
+ return result
362
366
 
363
- return result if self.callback is None else self.callback(result)
367
+ if bool(result):
368
+ return PokeReturnValue(
369
+ is_done=True,
370
+ xcom_value=result,
371
+ )
372
+ return False
364
373
 
365
374
  def execute(self, context: Context) -> Any:
366
375
  """Airflow runs this method on the worker and defers using the trigger."""
@@ -464,7 +473,7 @@ class DataflowJobAutoScalingEventsSensor(BaseSensorOperator):
464
473
  self.deferrable = deferrable
465
474
  self.poll_interval = poll_interval
466
475
 
467
- def poke(self, context: Context) -> bool:
476
+ def poke(self, context: Context) -> PokeReturnValue | bool:
468
477
  if self.fail_on_terminal_state:
469
478
  job = self.hook.get_job(
470
479
  job_id=self.job_id,
@@ -481,8 +490,16 @@ class DataflowJobAutoScalingEventsSensor(BaseSensorOperator):
481
490
  project_id=self.project_id,
482
491
  location=self.location,
483
492
  )
484
-
485
- return result if self.callback is None else self.callback(result)
493
+ result = result if self.callback is None else self.callback(result)
494
+ if isinstance(result, PokeReturnValue):
495
+ return result
496
+
497
+ if bool(result):
498
+ return PokeReturnValue(
499
+ is_done=True,
500
+ xcom_value=result,
501
+ )
502
+ return False
486
503
 
487
504
  def execute(self, context: Context) -> Any:
488
505
  """Airflow runs this method on the worker and defers using the trigger."""
@@ -23,11 +23,11 @@ from collections.abc import Iterable, Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
25
  from airflow.exceptions import AirflowException
26
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
26
27
  from airflow.providers.google.cloud.hooks.dataform import DataformHook
27
- from airflow.sensors.base import BaseSensorOperator
28
28
 
29
29
  if TYPE_CHECKING:
30
- from airflow.utils.context import Context
30
+ from airflow.providers.common.compat.sdk import Context
31
31
 
32
32
 
33
33
  class DataformWorkflowInvocationStateSensor(BaseSensorOperator):
@@ -23,12 +23,12 @@ from collections.abc import Iterable, Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
25
  from airflow.exceptions import AirflowException, AirflowNotFoundException
26
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
26
27
  from airflow.providers.google.cloud.hooks.datafusion import DataFusionHook
27
28
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
28
- from airflow.sensors.base import BaseSensorOperator
29
29
 
30
30
  if TYPE_CHECKING:
31
- from airflow.utils.context import Context
31
+ from airflow.providers.common.compat.sdk import Context
32
32
 
33
33
 
34
34
  class CloudDataFusionPipelineStateSensor(BaseSensorOperator):
@@ -110,7 +110,7 @@ class CloudDataFusionPipelineStateSensor(BaseSensorOperator):
110
110
  pipeline_id=self.pipeline_id,
111
111
  namespace=self.namespace,
112
112
  )
113
- pipeline_status = pipeline_workflow["status"]
113
+ pipeline_status = pipeline_workflow.get("status")
114
114
  except AirflowNotFoundException:
115
115
  message = "Specified Pipeline ID was not found."
116
116
  raise AirflowException(message)
@@ -127,4 +127,4 @@ class CloudDataFusionPipelineStateSensor(BaseSensorOperator):
127
127
  self.log.debug(
128
128
  "Current status of the pipeline workflow for %s: %s.", self.pipeline_id, pipeline_status
129
129
  )
130
- return pipeline_status in self.expected_statuses
130
+ return pipeline_status is not None and pipeline_status in self.expected_statuses
@@ -25,19 +25,19 @@ from typing import TYPE_CHECKING
25
25
  if TYPE_CHECKING:
26
26
  from google.api_core.retry import Retry
27
27
 
28
- from airflow.utils.context import Context
28
+ from airflow.providers.common.compat.sdk import Context
29
29
 
30
30
  from google.api_core.exceptions import GoogleAPICallError
31
31
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
32
32
  from google.cloud.dataplex_v1.types import DataScanJob
33
33
 
34
34
  from airflow.exceptions import AirflowException
35
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
35
36
  from airflow.providers.google.cloud.hooks.dataplex import (
36
37
  AirflowDataQualityScanException,
37
38
  AirflowDataQualityScanResultTimeoutException,
38
39
  DataplexHook,
39
40
  )
40
- from airflow.sensors.base import BaseSensorOperator
41
41
 
42
42
 
43
43
  class TaskState:
@@ -22,11 +22,11 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
25
26
  from airflow.providers.google.cloud.hooks.dataprep import GoogleDataprepHook, JobGroupStatuses
26
- from airflow.sensors.base import BaseSensorOperator
27
27
 
28
28
  if TYPE_CHECKING:
29
- from airflow.utils.context import Context
29
+ from airflow.providers.common.compat.sdk import Context
30
30
 
31
31
 
32
32
  class DataprepJobGroupIsFinishedSensor(BaseSensorOperator):
@@ -27,12 +27,12 @@ from google.api_core.exceptions import ServerError
27
27
  from google.cloud.dataproc_v1.types import Batch, JobStatus
28
28
 
29
29
  from airflow.exceptions import AirflowException
30
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
30
31
  from airflow.providers.google.cloud.hooks.dataproc import DataprocHook
31
32
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
32
- from airflow.sensors.base import BaseSensorOperator
33
33
 
34
34
  if TYPE_CHECKING:
35
- from airflow.utils.context import Context
35
+ from airflow.providers.common.compat.sdk import Context
36
36
 
37
37
 
38
38
  class DataprocJobSensor(BaseSensorOperator):
@@ -21,14 +21,14 @@ from collections.abc import Sequence
21
21
  from typing import TYPE_CHECKING
22
22
 
23
23
  from airflow.exceptions import AirflowException
24
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
24
25
  from airflow.providers.google.cloud.hooks.dataproc_metastore import DataprocMetastoreHook
25
26
  from airflow.providers.google.cloud.hooks.gcs import parse_json_from_gcs
26
- from airflow.sensors.base import BaseSensorOperator
27
27
 
28
28
  if TYPE_CHECKING:
29
29
  from google.api_core.operation import Operation
30
30
 
31
- from airflow.utils.context import Context
31
+ from airflow.providers.common.compat.sdk import Context
32
32
 
33
33
 
34
34
  class MetastoreHivePartitionSensor(BaseSensorOperator):
@@ -21,14 +21,15 @@ from __future__ import annotations
21
21
 
22
22
  import os
23
23
  import textwrap
24
- from collections.abc import Sequence
24
+ from collections.abc import Callable, Sequence
25
25
  from datetime import datetime, timedelta
26
- from typing import TYPE_CHECKING, Any, Callable
26
+ from typing import TYPE_CHECKING, Any
27
27
 
28
28
  from google.cloud.storage.retry import DEFAULT_RETRY
29
29
 
30
30
  from airflow.configuration import conf
31
31
  from airflow.exceptions import AirflowException
32
+ from airflow.providers.common.compat.sdk import BaseSensorOperator, poke_mode_only
32
33
  from airflow.providers.google.cloud.hooks.gcs import GCSHook
33
34
  from airflow.providers.google.cloud.triggers.gcs import (
34
35
  GCSBlobTrigger,
@@ -36,12 +37,11 @@ from airflow.providers.google.cloud.triggers.gcs import (
36
37
  GCSPrefixBlobTrigger,
37
38
  GCSUploadSessionTrigger,
38
39
  )
39
- from airflow.sensors.base import BaseSensorOperator, poke_mode_only
40
40
 
41
41
  if TYPE_CHECKING:
42
42
  from google.api_core.retry import Retry
43
43
 
44
- from airflow.utils.context import Context
44
+ from airflow.providers.common.compat.sdk import Context
45
45
 
46
46
 
47
47
  class GCSObjectExistenceSensor(BaseSensorOperator):
@@ -22,11 +22,11 @@ from __future__ import annotations
22
22
  from typing import TYPE_CHECKING
23
23
 
24
24
  from airflow.exceptions import AirflowException
25
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
25
26
  from airflow.providers.google.cloud.hooks.looker import JobStatus, LookerHook
26
- from airflow.sensors.base import BaseSensorOperator
27
27
 
28
28
  if TYPE_CHECKING:
29
- from airflow.utils.context import Context
29
+ from airflow.providers.common.compat.sdk import Context
30
30
 
31
31
 
32
32
  class LookerCheckPdtBuildSensor(BaseSensorOperator):
@@ -19,21 +19,21 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
- from collections.abc import Sequence
22
+ from collections.abc import Callable, Sequence
23
23
  from datetime import timedelta
24
- from typing import TYPE_CHECKING, Any, Callable
24
+ from typing import TYPE_CHECKING, Any
25
25
 
26
26
  from google.cloud import pubsub_v1
27
27
  from google.cloud.pubsub_v1.types import ReceivedMessage
28
28
 
29
29
  from airflow.configuration import conf
30
30
  from airflow.exceptions import AirflowException
31
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
31
32
  from airflow.providers.google.cloud.hooks.pubsub import PubSubHook
32
33
  from airflow.providers.google.cloud.triggers.pubsub import PubsubPullTrigger
33
- from airflow.sensors.base import BaseSensorOperator
34
34
 
35
35
  if TYPE_CHECKING:
36
- from airflow.utils.context import Context
36
+ from airflow.providers.common.compat.sdk import Context
37
37
 
38
38
 
39
39
  class PubSubMessageTransformException(AirflowException):
@@ -22,12 +22,12 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
25
26
  from airflow.providers.google.cloud.hooks.tasks import CloudTasksHook
26
27
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
27
- from airflow.sensors.base import BaseSensorOperator
28
28
 
29
29
  if TYPE_CHECKING:
30
- from airflow.utils.context import Context
30
+ from airflow.providers.common.compat.sdk import Context
31
31
 
32
32
 
33
33
  class TaskQueueEmptySensor(BaseSensorOperator):
@@ -24,11 +24,11 @@ from collections.abc import Sequence
24
24
  from typing import TYPE_CHECKING
25
25
 
26
26
  from airflow.exceptions import AirflowException
27
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
27
28
  from airflow.providers.google.cloud.hooks.vertex_ai.feature_store import FeatureStoreHook
28
- from airflow.sensors.base import BaseSensorOperator
29
29
 
30
30
  if TYPE_CHECKING:
31
- from airflow.utils.context import Context
31
+ from airflow.providers.common.compat.sdk import Context
32
32
 
33
33
 
34
34
  class FeatureViewSyncSensor(BaseSensorOperator):
@@ -23,14 +23,14 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
23
23
  from google.cloud.workflows.executions_v1beta import Execution
24
24
 
25
25
  from airflow.exceptions import AirflowException
26
+ from airflow.providers.common.compat.sdk import BaseSensorOperator
26
27
  from airflow.providers.google.cloud.hooks.workflows import WorkflowsHook
27
28
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
28
- from airflow.sensors.base import BaseSensorOperator
29
29
 
30
30
  if TYPE_CHECKING:
31
31
  from google.api_core.retry import Retry
32
32
 
33
- from airflow.utils.context import Context
33
+ from airflow.providers.common.compat.sdk import Context
34
34
 
35
35
 
36
36
  class WorkflowExecutionSensor(BaseSensorOperator):
@@ -35,7 +35,7 @@ except ModuleNotFoundError as e:
35
35
  raise AirflowOptionalProviderFeatureException(e)
36
36
 
37
37
  if TYPE_CHECKING:
38
- from airflow.utils.context import Context
38
+ from airflow.providers.common.compat.sdk import Context
39
39
 
40
40
 
41
41
  class ADLSToGCSOperator(ADLSListOperator):
@@ -21,8 +21,8 @@ import tempfile
21
21
  from collections.abc import Sequence
22
22
  from typing import TYPE_CHECKING
23
23
 
24
- from airflow.models import BaseOperator
25
24
  from airflow.providers.google.cloud.hooks.gcs import GCSHook
25
+ from airflow.providers.google.version_compat import BaseOperator
26
26
 
27
27
  try:
28
28
  from airflow.providers.microsoft.azure.hooks.wasb import WasbHook
@@ -32,7 +32,7 @@ except ModuleNotFoundError as e:
32
32
  raise AirflowOptionalProviderFeatureException(e)
33
33
 
34
34
  if TYPE_CHECKING:
35
- from airflow.utils.context import Context
35
+ from airflow.providers.common.compat.sdk import Context
36
36
 
37
37
 
38
38
  class AzureBlobStorageToGCSOperator(BaseOperator):
@@ -23,8 +23,8 @@ from tempfile import NamedTemporaryFile
23
23
  from typing import TYPE_CHECKING
24
24
 
25
25
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
26
- from airflow.models import BaseOperator
27
26
  from airflow.providers.google.cloud.hooks.gcs import GCSHook, _parse_gcs_url, gcs_object_is_directory
27
+ from airflow.providers.google.version_compat import BaseOperator
28
28
 
29
29
  try:
30
30
  from airflow.providers.microsoft.azure.hooks.fileshare import AzureFileShareHook
@@ -34,7 +34,7 @@ except ModuleNotFoundError as e:
34
34
  raise AirflowOptionalProviderFeatureException(e)
35
35
 
36
36
  if TYPE_CHECKING:
37
- from airflow.utils.context import Context
37
+ from airflow.providers.common.compat.sdk import Context
38
38
 
39
39
 
40
40
  class AzureFileShareToGCSOperator(BaseOperator):
@@ -22,12 +22,13 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
- from airflow.models import BaseOperator
26
25
  from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
27
26
  from airflow.providers.google.cloud.links.bigquery import BigQueryTableLink
27
+ from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
28
+ from airflow.providers.google.version_compat import BaseOperator
28
29
 
29
30
  if TYPE_CHECKING:
30
- from airflow.utils.context import Context
31
+ from airflow.providers.common.compat.sdk import Context
31
32
 
32
33
 
33
34
  class BigQueryToBigQueryOperator(BaseOperator):
@@ -73,6 +74,7 @@ class BigQueryToBigQueryOperator(BaseOperator):
73
74
  If set as a sequence, the identities from the list must grant
74
75
  Service Account Token Creator IAM role to the directly preceding identity, with first
75
76
  account from the list granting this role to the originating account (templated).
77
+ :param project_id: Google Cloud Project where the job is running
76
78
  """
77
79
 
78
80
  template_fields: Sequence[str] = (
@@ -93,6 +95,7 @@ class BigQueryToBigQueryOperator(BaseOperator):
93
95
  write_disposition: str = "WRITE_EMPTY",
94
96
  create_disposition: str = "CREATE_IF_NEEDED",
95
97
  gcp_conn_id: str = "google_cloud_default",
98
+ project_id: str = PROVIDE_PROJECT_ID,
96
99
  labels: dict | None = None,
97
100
  encryption_configuration: dict | None = None,
98
101
  location: str | None = None,
@@ -112,6 +115,7 @@ class BigQueryToBigQueryOperator(BaseOperator):
112
115
  self.impersonation_chain = impersonation_chain
113
116
  self.hook: BigQueryHook | None = None
114
117
  self._job_conf: dict = {}
118
+ self.project_id = project_id
115
119
 
116
120
  def _prepare_job_configuration(self):
117
121
  self.source_project_dataset_tables = (
@@ -124,7 +128,7 @@ class BigQueryToBigQueryOperator(BaseOperator):
124
128
  for source_project_dataset_table in self.source_project_dataset_tables:
125
129
  source_project, source_dataset, source_table = self.hook.split_tablename(
126
130
  table_input=source_project_dataset_table,
127
- default_project_id=self.hook.project_id,
131
+ default_project_id=self.project_id,
128
132
  var_name="source_project_dataset_table",
129
133
  )
130
134
  source_project_dataset_tables_fixup.append(
@@ -133,7 +137,7 @@ class BigQueryToBigQueryOperator(BaseOperator):
133
137
 
134
138
  destination_project, destination_dataset, destination_table = self.hook.split_tablename(
135
139
  table_input=self.destination_project_dataset_table,
136
- default_project_id=self.hook.project_id,
140
+ default_project_id=self.project_id,
137
141
  )
138
142
  configuration = {
139
143
  "copy": {
@@ -168,18 +172,17 @@ class BigQueryToBigQueryOperator(BaseOperator):
168
172
  impersonation_chain=self.impersonation_chain,
169
173
  )
170
174
 
171
- if not self.hook.project_id:
172
- raise ValueError("The project_id should be set")
175
+ if not self.project_id:
176
+ self.project_id = self.hook.project_id
173
177
 
174
178
  configuration = self._prepare_job_configuration()
175
179
  self._job_conf = self.hook.insert_job(
176
- configuration=configuration, project_id=self.hook.project_id
180
+ configuration=configuration, project_id=self.project_id
177
181
  ).to_api_repr()
178
182
 
179
183
  dest_table_info = self._job_conf["configuration"]["copy"]["destinationTable"]
180
184
  BigQueryTableLink.persist(
181
185
  context=context,
182
- task_instance=self,
183
186
  dataset_id=dest_table_info["datasetId"],
184
187
  project_id=dest_table_info["projectId"],
185
188
  table_id=dest_table_info["tableId"],
@@ -27,17 +27,17 @@ from google.cloud.bigquery import DEFAULT_RETRY, UnknownJob
27
27
 
28
28
  from airflow.configuration import conf
29
29
  from airflow.exceptions import AirflowException
30
- from airflow.models import BaseOperator
31
30
  from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook, BigQueryJob
32
31
  from airflow.providers.google.cloud.links.bigquery import BigQueryTableLink
33
32
  from airflow.providers.google.cloud.triggers.bigquery import BigQueryInsertJobTrigger
34
33
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
34
+ from airflow.providers.google.version_compat import BaseOperator
35
35
  from airflow.utils.helpers import merge_dicts
36
36
 
37
37
  if TYPE_CHECKING:
38
38
  from google.api_core.retry import Retry
39
39
 
40
- from airflow.utils.context import Context
40
+ from airflow.providers.common.compat.sdk import Context
41
41
 
42
42
 
43
43
  class BigQueryToGCSOperator(BaseOperator):
@@ -215,8 +215,9 @@ class BigQueryToGCSOperator(BaseOperator):
215
215
  job_id=self.job_id,
216
216
  dag_id=self.dag_id,
217
217
  task_id=self.task_id,
218
- logical_date=context["logical_date"],
218
+ logical_date=None,
219
219
  configuration=configuration,
220
+ run_after=hook.get_run_after_or_logical_date(context),
220
221
  force_rerun=self.force_rerun,
221
222
  )
222
223
 
@@ -254,7 +255,6 @@ class BigQueryToGCSOperator(BaseOperator):
254
255
  dataset_id, project_id, table_id = conf["datasetId"], conf["projectId"], conf["tableId"]
255
256
  BigQueryTableLink.persist(
256
257
  context=context,
257
- task_instance=self,
258
258
  dataset_id=dataset_id,
259
259
  project_id=project_id,
260
260
  table_id=table_id,
@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  import warnings
23
23
  from collections.abc import Sequence
24
+ from functools import cached_property
24
25
  from typing import TYPE_CHECKING
25
26
 
26
27
  from airflow.exceptions import AirflowProviderDeprecationWarning
@@ -29,7 +30,7 @@ from airflow.providers.google.cloud.transfers.bigquery_to_sql import BigQueryToS
29
30
  from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook
30
31
 
31
32
  if TYPE_CHECKING:
32
- from airflow.utils.context import Context
33
+ from airflow.providers.common.compat.sdk import Context
33
34
 
34
35
 
35
36
  class BigQueryToMsSqlOperator(BigQueryToSqlBaseOperator):
@@ -94,14 +95,17 @@ class BigQueryToMsSqlOperator(BigQueryToSqlBaseOperator):
94
95
  self.mssql_conn_id = mssql_conn_id
95
96
  self.source_project_dataset_table = source_project_dataset_table
96
97
 
97
- def get_sql_hook(self) -> MsSqlHook:
98
+ @cached_property
99
+ def mssql_hook(self) -> MsSqlHook:
98
100
  return MsSqlHook(schema=self.database, mssql_conn_id=self.mssql_conn_id)
99
101
 
102
+ def get_sql_hook(self) -> MsSqlHook:
103
+ return self.mssql_hook
104
+
100
105
  def persist_links(self, context: Context) -> None:
101
106
  project_id, dataset_id, table_id = self.source_project_dataset_table.split(".")
102
107
  BigQueryTableLink.persist(
103
108
  context=context,
104
- task_instance=self,
105
109
  dataset_id=dataset_id,
106
110
  project_id=project_id,
107
111
  table_id=table_id,
@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  import warnings
23
23
  from collections.abc import Sequence
24
+ from functools import cached_property
24
25
 
25
26
  from airflow.exceptions import AirflowProviderDeprecationWarning
26
27
  from airflow.providers.google.cloud.transfers.bigquery_to_sql import BigQueryToSqlBaseOperator
@@ -76,5 +77,15 @@ class BigQueryToMySqlOperator(BigQueryToSqlBaseOperator):
76
77
  )
77
78
  self.mysql_conn_id = mysql_conn_id
78
79
 
79
- def get_sql_hook(self) -> MySqlHook:
80
+ @cached_property
81
+ def mysql_hook(self) -> MySqlHook:
80
82
  return MySqlHook(schema=self.database, mysql_conn_id=self.mysql_conn_id)
83
+
84
+ def get_sql_hook(self) -> MySqlHook:
85
+ return self.mysql_hook
86
+
87
+ def execute(self, context):
88
+ # Set source_project_dataset_table here, after hooks are initialized and project_id is available
89
+ project_id = self.bigquery_hook.project_id
90
+ self.source_project_dataset_table = f"{project_id}.{self.dataset_id}.{self.table_id}"
91
+ return super().execute(context)
@@ -19,15 +19,19 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
+ from functools import cached_property
22
23
  from typing import TYPE_CHECKING
23
24
 
25
+ from psycopg2.extensions import register_adapter
26
+ from psycopg2.extras import Json
27
+
24
28
  from airflow.providers.google.cloud.hooks.bigquery import BigQueryHook
25
29
  from airflow.providers.google.cloud.transfers.bigquery_to_sql import BigQueryToSqlBaseOperator
26
30
  from airflow.providers.google.cloud.utils.bigquery_get_data import bigquery_get_data
27
31
  from airflow.providers.postgres.hooks.postgres import PostgresHook
28
32
 
29
33
  if TYPE_CHECKING:
30
- from airflow.utils.context import Context
34
+ from airflow.providers.common.compat.sdk import Context
31
35
 
32
36
 
33
37
  class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
@@ -75,26 +79,36 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
75
79
  self.postgres_conn_id = postgres_conn_id
76
80
  self.replace_index = replace_index
77
81
 
78
- def get_sql_hook(self) -> PostgresHook:
82
+ @cached_property
83
+ def postgres_hook(self) -> PostgresHook:
84
+ register_adapter(list, Json)
85
+ register_adapter(dict, Json)
79
86
  return PostgresHook(database=self.database, postgres_conn_id=self.postgres_conn_id)
80
87
 
88
+ def get_sql_hook(self) -> PostgresHook:
89
+ return self.postgres_hook
90
+
81
91
  def execute(self, context: Context) -> None:
82
- big_query_hook = BigQueryHook(
83
- gcp_conn_id=self.gcp_conn_id,
84
- location=self.location,
85
- impersonation_chain=self.impersonation_chain,
86
- )
92
+ if not self.bigquery_hook:
93
+ self.bigquery_hook = BigQueryHook(
94
+ gcp_conn_id=self.gcp_conn_id,
95
+ location=self.location,
96
+ impersonation_chain=self.impersonation_chain,
97
+ )
98
+ # Set source_project_dataset_table here, after hooks are initialized and project_id is available
99
+ project_id = self.bigquery_hook.project_id
100
+ self.source_project_dataset_table = f"{project_id}.{self.dataset_id}.{self.table_id}"
101
+
87
102
  self.persist_links(context)
88
- sql_hook: PostgresHook = self.get_sql_hook()
89
103
  for rows in bigquery_get_data(
90
104
  self.log,
91
105
  self.dataset_id,
92
106
  self.table_id,
93
- big_query_hook,
107
+ self.bigquery_hook,
94
108
  self.batch_size,
95
109
  self.selected_fields,
96
110
  ):
97
- sql_hook.insert_rows(
111
+ self.postgres_hook.insert_rows(
98
112
  table=self.target_table_name,
99
113
  rows=rows,
100
114
  target_fields=self.selected_fields,