apache-airflow-providers-google 10.26.0rc1__py3-none-any.whl → 11.0.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 (205) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +2 -1
  3. airflow/providers/google/ads/operators/ads.py +2 -1
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +2 -1
  5. airflow/providers/google/assets/gcs.py +17 -1
  6. airflow/providers/google/cloud/hooks/automl.py +3 -6
  7. airflow/providers/google/cloud/hooks/bigquery.py +41 -1486
  8. airflow/providers/google/cloud/hooks/bigquery_dts.py +4 -11
  9. airflow/providers/google/cloud/hooks/bigtable.py +3 -6
  10. airflow/providers/google/cloud/hooks/cloud_batch.py +6 -3
  11. airflow/providers/google/cloud/hooks/cloud_build.py +3 -15
  12. airflow/providers/google/cloud/hooks/cloud_composer.py +2 -17
  13. airflow/providers/google/cloud/hooks/cloud_memorystore.py +5 -6
  14. airflow/providers/google/cloud/hooks/cloud_run.py +10 -5
  15. airflow/providers/google/cloud/hooks/cloud_sql.py +5 -7
  16. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +3 -7
  17. airflow/providers/google/cloud/hooks/compute.py +3 -6
  18. airflow/providers/google/cloud/hooks/compute_ssh.py +0 -5
  19. airflow/providers/google/cloud/hooks/datacatalog.py +3 -6
  20. airflow/providers/google/cloud/hooks/dataflow.py +3 -14
  21. airflow/providers/google/cloud/hooks/dataform.py +2 -9
  22. airflow/providers/google/cloud/hooks/datafusion.py +4 -15
  23. airflow/providers/google/cloud/hooks/dataplex.py +4 -7
  24. airflow/providers/google/cloud/hooks/dataprep.py +2 -2
  25. airflow/providers/google/cloud/hooks/dataproc.py +77 -22
  26. airflow/providers/google/cloud/hooks/dataproc_metastore.py +2 -9
  27. airflow/providers/google/cloud/hooks/datastore.py +3 -6
  28. airflow/providers/google/cloud/hooks/dlp.py +3 -6
  29. airflow/providers/google/cloud/hooks/functions.py +2 -6
  30. airflow/providers/google/cloud/hooks/gcs.py +2 -18
  31. airflow/providers/google/cloud/hooks/gdm.py +1 -17
  32. airflow/providers/google/cloud/hooks/kms.py +3 -6
  33. airflow/providers/google/cloud/hooks/kubernetes_engine.py +7 -97
  34. airflow/providers/google/cloud/hooks/life_sciences.py +2 -6
  35. airflow/providers/google/cloud/hooks/looker.py +2 -1
  36. airflow/providers/google/cloud/hooks/mlengine.py +0 -8
  37. airflow/providers/google/cloud/hooks/natural_language.py +3 -6
  38. airflow/providers/google/cloud/hooks/os_login.py +3 -6
  39. airflow/providers/google/cloud/hooks/pubsub.py +3 -6
  40. airflow/providers/google/cloud/hooks/secret_manager.py +3 -73
  41. airflow/providers/google/cloud/hooks/spanner.py +3 -6
  42. airflow/providers/google/cloud/hooks/speech_to_text.py +3 -6
  43. airflow/providers/google/cloud/hooks/stackdriver.py +3 -6
  44. airflow/providers/google/cloud/hooks/tasks.py +3 -6
  45. airflow/providers/google/cloud/hooks/text_to_speech.py +3 -6
  46. airflow/providers/google/cloud/hooks/translate.py +455 -9
  47. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +3 -6
  48. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -6
  49. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +3 -6
  50. airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +2 -9
  51. airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -9
  52. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -14
  53. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -6
  54. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -9
  55. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -1
  56. airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -1
  57. airflow/providers/google/cloud/hooks/video_intelligence.py +3 -6
  58. airflow/providers/google/cloud/hooks/vision.py +3 -6
  59. airflow/providers/google/cloud/hooks/workflows.py +2 -9
  60. airflow/providers/google/cloud/links/dataproc.py +0 -1
  61. airflow/providers/google/cloud/links/translate.py +91 -0
  62. airflow/providers/google/cloud/log/gcs_task_handler.py +2 -1
  63. airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -3
  64. airflow/providers/google/cloud/openlineage/utils.py +54 -21
  65. airflow/providers/google/cloud/operators/automl.py +5 -4
  66. airflow/providers/google/cloud/operators/bigquery.py +2 -341
  67. airflow/providers/google/cloud/operators/bigquery_dts.py +2 -1
  68. airflow/providers/google/cloud/operators/bigtable.py +2 -1
  69. airflow/providers/google/cloud/operators/cloud_batch.py +2 -1
  70. airflow/providers/google/cloud/operators/cloud_build.py +2 -1
  71. airflow/providers/google/cloud/operators/cloud_composer.py +2 -1
  72. airflow/providers/google/cloud/operators/cloud_memorystore.py +2 -1
  73. airflow/providers/google/cloud/operators/cloud_run.py +2 -1
  74. airflow/providers/google/cloud/operators/cloud_sql.py +2 -1
  75. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +2 -1
  76. airflow/providers/google/cloud/operators/compute.py +2 -1
  77. airflow/providers/google/cloud/operators/datacatalog.py +2 -1
  78. airflow/providers/google/cloud/operators/dataflow.py +2 -517
  79. airflow/providers/google/cloud/operators/dataform.py +2 -1
  80. airflow/providers/google/cloud/operators/datafusion.py +2 -1
  81. airflow/providers/google/cloud/operators/dataplex.py +37 -31
  82. airflow/providers/google/cloud/operators/dataprep.py +2 -1
  83. airflow/providers/google/cloud/operators/dataproc.py +3 -633
  84. airflow/providers/google/cloud/operators/dataproc_metastore.py +2 -1
  85. airflow/providers/google/cloud/operators/datastore.py +2 -1
  86. airflow/providers/google/cloud/operators/dlp.py +2 -1
  87. airflow/providers/google/cloud/operators/functions.py +2 -1
  88. airflow/providers/google/cloud/operators/gcs.py +5 -4
  89. airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -11
  90. airflow/providers/google/cloud/operators/life_sciences.py +2 -1
  91. airflow/providers/google/cloud/operators/mlengine.py +2 -1
  92. airflow/providers/google/cloud/operators/natural_language.py +3 -2
  93. airflow/providers/google/cloud/operators/pubsub.py +2 -1
  94. airflow/providers/google/cloud/operators/spanner.py +2 -1
  95. airflow/providers/google/cloud/operators/speech_to_text.py +2 -1
  96. airflow/providers/google/cloud/operators/stackdriver.py +2 -1
  97. airflow/providers/google/cloud/operators/tasks.py +3 -2
  98. airflow/providers/google/cloud/operators/text_to_speech.py +2 -1
  99. airflow/providers/google/cloud/operators/translate.py +622 -32
  100. airflow/providers/google/cloud/operators/translate_speech.py +2 -1
  101. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +2 -93
  102. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +3 -13
  103. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +2 -17
  104. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +2 -1
  105. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +2 -1
  106. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +2 -1
  107. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +3 -13
  108. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +2 -1
  109. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +2 -1
  110. airflow/providers/google/cloud/operators/video_intelligence.py +2 -1
  111. airflow/providers/google/cloud/operators/vision.py +3 -2
  112. airflow/providers/google/cloud/operators/workflows.py +3 -2
  113. airflow/providers/google/cloud/secrets/secret_manager.py +2 -19
  114. airflow/providers/google/cloud/sensors/bigquery.py +2 -81
  115. airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -1
  116. airflow/providers/google/cloud/sensors/bigtable.py +2 -1
  117. airflow/providers/google/cloud/sensors/cloud_composer.py +8 -94
  118. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -1
  119. airflow/providers/google/cloud/sensors/dataflow.py +2 -1
  120. airflow/providers/google/cloud/sensors/dataform.py +2 -1
  121. airflow/providers/google/cloud/sensors/datafusion.py +2 -1
  122. airflow/providers/google/cloud/sensors/dataplex.py +2 -1
  123. airflow/providers/google/cloud/sensors/dataprep.py +2 -1
  124. airflow/providers/google/cloud/sensors/dataproc.py +2 -1
  125. airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -1
  126. airflow/providers/google/cloud/sensors/gcs.py +4 -36
  127. airflow/providers/google/cloud/sensors/pubsub.py +2 -1
  128. airflow/providers/google/cloud/sensors/tasks.py +2 -1
  129. airflow/providers/google/cloud/sensors/workflows.py +2 -1
  130. airflow/providers/google/cloud/transfers/adls_to_gcs.py +2 -1
  131. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -1
  132. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -1
  133. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +75 -18
  134. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +9 -7
  135. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +2 -1
  136. airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +1 -1
  137. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +2 -1
  138. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +2 -1
  139. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +2 -1
  140. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +2 -1
  141. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +13 -9
  142. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -1
  143. airflow/providers/google/cloud/transfers/gcs_to_local.py +2 -1
  144. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +2 -1
  145. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +2 -1
  146. airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -1
  147. airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -1
  148. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
  149. airflow/providers/google/cloud/transfers/s3_to_gcs.py +2 -1
  150. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -1
  151. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +2 -1
  152. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -1
  153. airflow/providers/google/cloud/transfers/sql_to_gcs.py +2 -1
  154. airflow/providers/google/cloud/triggers/bigquery.py +2 -1
  155. airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
  156. airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
  157. airflow/providers/google/cloud/triggers/cloud_build.py +2 -1
  158. airflow/providers/google/cloud/triggers/cloud_composer.py +3 -2
  159. airflow/providers/google/cloud/triggers/cloud_run.py +2 -1
  160. airflow/providers/google/cloud/triggers/cloud_sql.py +1 -1
  161. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +2 -1
  162. airflow/providers/google/cloud/triggers/dataflow.py +2 -1
  163. airflow/providers/google/cloud/triggers/datafusion.py +2 -1
  164. airflow/providers/google/cloud/triggers/dataplex.py +1 -1
  165. airflow/providers/google/cloud/triggers/dataproc.py +2 -1
  166. airflow/providers/google/cloud/triggers/gcs.py +3 -2
  167. airflow/providers/google/cloud/triggers/kubernetes_engine.py +2 -1
  168. airflow/providers/google/cloud/triggers/mlengine.py +2 -1
  169. airflow/providers/google/cloud/triggers/pubsub.py +2 -1
  170. airflow/providers/google/cloud/triggers/vertex_ai.py +2 -1
  171. airflow/providers/google/cloud/utils/credentials_provider.py +1 -1
  172. airflow/providers/google/cloud/utils/dataform.py +1 -1
  173. airflow/providers/google/cloud/utils/field_validator.py +2 -1
  174. airflow/providers/google/cloud/utils/mlengine_operator_utils.py +2 -1
  175. airflow/providers/google/common/hooks/base_google.py +4 -11
  176. airflow/providers/google/common/hooks/discovery_api.py +1 -6
  177. airflow/providers/google/firebase/hooks/firestore.py +1 -1
  178. airflow/providers/google/firebase/operators/firestore.py +2 -1
  179. airflow/providers/google/get_provider_info.py +7 -22
  180. airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -1
  181. airflow/providers/google/marketing_platform/hooks/campaign_manager.py +2 -3
  182. airflow/providers/google/marketing_platform/hooks/display_video.py +4 -3
  183. airflow/providers/google/marketing_platform/hooks/search_ads.py +6 -6
  184. airflow/providers/google/marketing_platform/operators/analytics_admin.py +2 -1
  185. airflow/providers/google/marketing_platform/operators/campaign_manager.py +2 -42
  186. airflow/providers/google/marketing_platform/operators/display_video.py +2 -47
  187. airflow/providers/google/marketing_platform/operators/search_ads.py +2 -1
  188. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -7
  189. airflow/providers/google/marketing_platform/sensors/display_video.py +2 -13
  190. airflow/providers/google/suite/hooks/calendar.py +2 -8
  191. airflow/providers/google/suite/hooks/drive.py +2 -6
  192. airflow/providers/google/suite/hooks/sheets.py +2 -7
  193. airflow/providers/google/suite/operators/sheets.py +2 -7
  194. airflow/providers/google/suite/sensors/drive.py +2 -7
  195. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -7
  196. airflow/providers/google/suite/transfers/gcs_to_sheets.py +2 -7
  197. airflow/providers/google/suite/transfers/local_to_drive.py +2 -7
  198. airflow/providers/google/suite/transfers/sql_to_sheets.py +2 -7
  199. {apache_airflow_providers_google-10.26.0rc1.dist-info → apache_airflow_providers_google-11.0.0rc1.dist-info}/METADATA +10 -10
  200. apache_airflow_providers_google-11.0.0rc1.dist-info/RECORD +315 -0
  201. airflow/providers/google/marketing_platform/hooks/analytics.py +0 -211
  202. airflow/providers/google/marketing_platform/operators/analytics.py +0 -551
  203. apache_airflow_providers_google-10.26.0rc1.dist-info/RECORD +0 -317
  204. {apache_airflow_providers_google-10.26.0rc1.dist-info → apache_airflow_providers_google-11.0.0rc1.dist-info}/WHEEL +0 -0
  205. {apache_airflow_providers_google-10.26.0rc1.dist-info → apache_airflow_providers_google-11.0.0rc1.dist-info}/entry_points.txt +0 -0
@@ -20,7 +20,8 @@
20
20
 
21
21
  from __future__ import annotations
22
22
 
23
- from typing import TYPE_CHECKING, Sequence
23
+ from collections.abc import Sequence
24
+ from typing import TYPE_CHECKING
24
25
 
25
26
  from google.api_core.client_options import ClientOptions
26
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
@@ -42,14 +43,6 @@ if TYPE_CHECKING:
42
43
  class ModelServiceHook(GoogleBaseHook):
43
44
  """Hook for Google Cloud Vertex AI Endpoint Service APIs."""
44
45
 
45
- def __init__(self, **kwargs):
46
- if kwargs.get("delegate_to") is not None:
47
- raise RuntimeError(
48
- "The `delegate_to` parameter has been deprecated before and finally removed in this version"
49
- " of Google Provider. You MUST convert it to `impersonate_chain`"
50
- )
51
- super().__init__(**kwargs)
52
-
53
46
  def get_model_service_client(self, region: str | None = None) -> ModelServiceClient:
54
47
  """Return ModelServiceClient object."""
55
48
  if region and region != "global":
@@ -26,7 +26,8 @@ This module contains a Google Cloud Vertex AI hook.
26
26
  from __future__ import annotations
27
27
 
28
28
  import asyncio
29
- from typing import TYPE_CHECKING, Any, Sequence
29
+ from collections.abc import Sequence
30
+ from typing import TYPE_CHECKING, Any
30
31
 
31
32
  from google.api_core.client_options import ClientOptions
32
33
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
@@ -62,6 +63,7 @@ class PipelineJobHook(GoogleBaseHook):
62
63
  super().__init__(
63
64
  gcp_conn_id=gcp_conn_id,
64
65
  impersonation_chain=impersonation_chain,
66
+ **kwargs,
65
67
  )
66
68
  self._pipeline_job: PipelineJob | None = None
67
69
 
@@ -17,7 +17,8 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- from typing import TYPE_CHECKING, Sequence
20
+ from collections.abc import Sequence
21
+ from typing import TYPE_CHECKING
21
22
 
22
23
  from google.api_core.client_options import ClientOptions
23
24
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
@@ -19,7 +19,8 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
- from typing import TYPE_CHECKING, Sequence
22
+ from collections.abc import Sequence
23
+ from typing import TYPE_CHECKING
23
24
 
24
25
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
25
26
  from google.cloud.videointelligence_v1 import (
@@ -60,14 +61,10 @@ class CloudVideoIntelligenceHook(GoogleBaseHook):
60
61
  impersonation_chain: str | Sequence[str] | None = None,
61
62
  **kwargs,
62
63
  ) -> None:
63
- if kwargs.get("delegate_to") is not None:
64
- raise RuntimeError(
65
- "The `delegate_to` parameter has been deprecated before and finally removed in this version"
66
- " of Google Provider. You MUST convert it to `impersonate_chain`"
67
- )
68
64
  super().__init__(
69
65
  gcp_conn_id=gcp_conn_id,
70
66
  impersonation_chain=impersonation_chain,
67
+ **kwargs,
71
68
  )
72
69
  self._conn: VideoIntelligenceServiceClient | None = None
73
70
 
@@ -19,9 +19,10 @@
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
+ from collections.abc import Sequence
22
23
  from copy import deepcopy
23
24
  from functools import cached_property
24
- from typing import TYPE_CHECKING, Any, Callable, Sequence
25
+ from typing import TYPE_CHECKING, Any, Callable
25
26
 
26
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
28
  from google.cloud.vision_v1 import (
@@ -130,14 +131,10 @@ class CloudVisionHook(GoogleBaseHook):
130
131
  impersonation_chain: str | Sequence[str] | None = None,
131
132
  **kwargs,
132
133
  ) -> None:
133
- if kwargs.get("delegate_to") is not None:
134
- raise RuntimeError(
135
- "The `delegate_to` parameter has been deprecated before and finally removed in this version"
136
- " of Google Provider. You MUST convert it to `impersonate_chain`"
137
- )
138
134
  super().__init__(
139
135
  gcp_conn_id=gcp_conn_id,
140
136
  impersonation_chain=impersonation_chain,
137
+ **kwargs,
141
138
  )
142
139
  self._client = None
143
140
 
@@ -16,7 +16,8 @@
16
16
  # under the License.
17
17
  from __future__ import annotations
18
18
 
19
- from typing import TYPE_CHECKING, Sequence
19
+ from collections.abc import Sequence
20
+ from typing import TYPE_CHECKING
20
21
 
21
22
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
22
23
  from google.cloud.workflows.executions_v1beta import Execution, ExecutionsClient
@@ -41,14 +42,6 @@ class WorkflowsHook(GoogleBaseHook):
41
42
  keyword arguments rather than positional.
42
43
  """
43
44
 
44
- def __init__(self, **kwargs):
45
- if kwargs.get("delegate_to") is not None:
46
- raise RuntimeError(
47
- "The `delegate_to` parameter has been deprecated before and finally removed in this version"
48
- " of Google Provider. You MUST convert it to `impersonate_chain`"
49
- )
50
- super().__init__(**kwargs)
51
-
52
45
  def get_workflows_client(self) -> WorkflowsClient:
53
46
  """Return WorkflowsClient object."""
54
47
  return WorkflowsClient(credentials=self.get_credentials(), client_info=CLIENT_INFO)
@@ -121,7 +121,6 @@ class DataprocLink(BaseOperatorLink):
121
121
  # This link is still used into the selected operators
122
122
  # - airflow.providers.google.cloud.operators.dataproc.DataprocScaleClusterOperator
123
123
  # - airflow.providers.google.cloud.operators.dataproc.DataprocJobBaseOperator
124
- # - airflow.providers.google.cloud.operators.dataproc.DataprocSubmitPigJobOperator
125
124
  # As soon as we remove reference to this link we might deprecate it by add warning message
126
125
  # with `stacklevel=3` below in this method.
127
126
  ...
@@ -43,6 +43,13 @@ TRANSLATION_LEGACY_MODEL_PREDICT_LINK = (
43
43
  + "/locations/{location}/datasets/{dataset_id}/predict;modelId={model_id}?project={project_id}"
44
44
  )
45
45
 
46
+ TRANSLATION_TRANSLATE_TEXT_BATCH = BASE_LINK + "/storage/browser/{output_uri_prefix}?project={project_id}"
47
+
48
+ TRANSLATION_NATIVE_DATASET_LINK = (
49
+ TRANSLATION_BASE_LINK + "/locations/{location}/datasets/{dataset_id}/sentences?project={project_id}"
50
+ )
51
+ TRANSLATION_NATIVE_LIST_LINK = TRANSLATION_BASE_LINK + "/datasets?project={project_id}"
52
+
46
53
 
47
54
  class TranslationLegacyDatasetLink(BaseGoogleLink):
48
55
  """
@@ -179,3 +186,87 @@ class TranslationLegacyModelPredictLink(BaseGoogleLink):
179
186
  "project_id": project_id,
180
187
  },
181
188
  )
189
+
190
+
191
+ class TranslateTextBatchLink(BaseGoogleLink):
192
+ """
193
+ Helper class for constructing Translation results for the text batch translate.
194
+
195
+ Provides link to output results.
196
+
197
+ """
198
+
199
+ name = "Text Translate Batch"
200
+ key = "translate_text_batch"
201
+ format_str = TRANSLATION_TRANSLATE_TEXT_BATCH
202
+
203
+ @staticmethod
204
+ def extract_output_uri_prefix(output_config):
205
+ return output_config["gcs_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
206
+
207
+ @staticmethod
208
+ def persist(
209
+ context: Context,
210
+ task_instance,
211
+ project_id: str,
212
+ output_config: dict,
213
+ ):
214
+ task_instance.xcom_push(
215
+ context,
216
+ key=TranslateTextBatchLink.key,
217
+ value={
218
+ "project_id": project_id,
219
+ "output_uri_prefix": TranslateTextBatchLink.extract_output_uri_prefix(output_config),
220
+ },
221
+ )
222
+
223
+
224
+ class TranslationNativeDatasetLink(BaseGoogleLink):
225
+ """
226
+ Helper class for constructing Legacy Translation Dataset link.
227
+
228
+ Legacy Datasets are created and managed by AutoML API.
229
+ """
230
+
231
+ name = "Translation Native Dataset"
232
+ key = "translation_naive_dataset"
233
+ format_str = TRANSLATION_NATIVE_DATASET_LINK
234
+
235
+ @staticmethod
236
+ def persist(
237
+ context: Context,
238
+ task_instance,
239
+ dataset_id: str,
240
+ project_id: str,
241
+ ):
242
+ task_instance.xcom_push(
243
+ context,
244
+ key=TranslationNativeDatasetLink.key,
245
+ value={"location": task_instance.location, "dataset_id": dataset_id, "project_id": project_id},
246
+ )
247
+
248
+
249
+ class TranslationDatasetsListLink(BaseGoogleLink):
250
+ """
251
+ Helper class for constructing Translation Datasets List link.
252
+
253
+ Both legacy and native datasets are available under this link.
254
+ """
255
+
256
+ name = "Translation Dataset List"
257
+ key = "translation_dataset_list"
258
+ format_str = TRANSLATION_DATASET_LIST_LINK
259
+
260
+ @staticmethod
261
+ def persist(
262
+ context: Context,
263
+ task_instance,
264
+ project_id: str,
265
+ ):
266
+ task_instance.xcom_push(
267
+ context,
268
+ key=TranslationDatasetsListLink.key,
269
+ value={
270
+ "project_id": project_id,
271
+ },
272
+ )
@@ -20,9 +20,10 @@ from __future__ import annotations
20
20
  import logging
21
21
  import os
22
22
  import shutil
23
+ from collections.abc import Collection
23
24
  from functools import cached_property
24
25
  from pathlib import Path
25
- from typing import TYPE_CHECKING, Collection
26
+ from typing import TYPE_CHECKING
26
27
 
27
28
  # not sure why but mypy complains on missing `storage` but it is clearly there and is importable
28
29
  from google.cloud import storage # type: ignore[attr-defined]
@@ -20,8 +20,9 @@ from __future__ import annotations
20
20
 
21
21
  import logging
22
22
  import warnings
23
+ from collections.abc import Collection
23
24
  from functools import cached_property
24
- from typing import TYPE_CHECKING, Collection
25
+ from typing import TYPE_CHECKING
25
26
  from urllib.parse import urlencode
26
27
 
27
28
  from google.cloud import logging as gcp_logging
@@ -29,13 +30,18 @@ from google.cloud.logging import Resource
29
30
  from google.cloud.logging.handlers.transports import BackgroundThreadTransport, Transport
30
31
  from google.cloud.logging_v2.services.logging_service_v2 import LoggingServiceV2Client
31
32
  from google.cloud.logging_v2.types import ListLogEntriesRequest, ListLogEntriesResponse
33
+ from packaging.version import Version
32
34
 
35
+ from airflow import __version__ as airflow_version
33
36
  from airflow.exceptions import RemovedInAirflow3Warning
34
37
  from airflow.providers.google.cloud.utils.credentials_provider import get_credentials_and_project_id
35
38
  from airflow.providers.google.common.consts import CLIENT_INFO
36
39
  from airflow.utils.log.trigger_handler import ctx_indiv_trigger
37
40
  from airflow.utils.types import NOTSET, ArgNotSet
38
41
 
42
+ AIRFLOW_VERSION = Version(airflow_version)
43
+ AIRFLOW_V_3_0_PLUS = Version(AIRFLOW_VERSION.base_version) >= Version("3.0.0")
44
+
39
45
  if TYPE_CHECKING:
40
46
  from google.auth.credentials import Credentials
41
47
 
@@ -82,7 +88,7 @@ class StackdriverTaskHandler(logging.Handler):
82
88
 
83
89
  LABEL_TASK_ID = "task_id"
84
90
  LABEL_DAG_ID = "dag_id"
85
- LABEL_EXECUTION_DATE = "execution_date"
91
+ LABEL_LOGICAL_DATE = "logical_date" if AIRFLOW_V_3_0_PLUS else "execution_date"
86
92
  LABEL_TRY_NUMBER = "try_number"
87
93
  LOG_VIEWER_BASE_URL = "https://console.cloud.google.com/logs/viewer"
88
94
  LOG_NAME = "Google Stackdriver"
@@ -338,7 +344,9 @@ class StackdriverTaskHandler(logging.Handler):
338
344
  return {
339
345
  cls.LABEL_TASK_ID: ti.task_id,
340
346
  cls.LABEL_DAG_ID: ti.dag_id,
341
- cls.LABEL_EXECUTION_DATE: str(ti.execution_date.isoformat()),
347
+ cls.LABEL_LOGICAL_DATE: str(ti.logical_date.isoformat())
348
+ if AIRFLOW_V_3_0_PLUS
349
+ else str(ti.execution_date.isoformat()),
342
350
  cls.LABEL_TRY_NUMBER: str(ti.try_number),
343
351
  }
344
352
 
@@ -27,6 +27,7 @@ if TYPE_CHECKING:
27
27
  from airflow.providers.common.compat.openlineage.facet import Dataset
28
28
 
29
29
  from airflow.providers.common.compat.openlineage.facet import (
30
+ BaseFacet,
30
31
  ColumnLineageDatasetFacet,
31
32
  DocumentationDatasetFacet,
32
33
  Fields,
@@ -41,50 +42,82 @@ BIGQUERY_NAMESPACE = "bigquery"
41
42
  BIGQUERY_URI = "bigquery"
42
43
 
43
44
 
44
- def get_facets_from_bq_table(table: Table) -> dict[Any, Any]:
45
+ def get_facets_from_bq_table(table: Table) -> dict[str, BaseFacet]:
45
46
  """Get facets from BigQuery table object."""
46
- facets = {
47
- "schema": SchemaDatasetFacet(
47
+ facets: dict[str, BaseFacet] = {}
48
+ if table.schema:
49
+ facets["schema"] = SchemaDatasetFacet(
48
50
  fields=[
49
51
  SchemaDatasetFacetFields(
50
- name=field.name, type=field.field_type, description=field.description
52
+ name=schema_field.name, type=schema_field.field_type, description=schema_field.description
51
53
  )
52
- for field in table.schema
54
+ for schema_field in table.schema
53
55
  ]
54
- ),
55
- "documentation": DocumentationDatasetFacet(description=table.description or ""),
56
- }
56
+ )
57
+ if table.description:
58
+ facets["documentation"] = DocumentationDatasetFacet(description=table.description)
57
59
 
58
60
  return facets
59
61
 
60
62
 
61
63
  def get_identity_column_lineage_facet(
62
- field_names: list[str],
64
+ dest_field_names: list[str],
63
65
  input_datasets: list[Dataset],
64
- ) -> ColumnLineageDatasetFacet:
66
+ ) -> dict[str, ColumnLineageDatasetFacet]:
65
67
  """
66
- Get column lineage facet.
67
-
68
- Simple lineage will be created, where each source column corresponds to single destination column
69
- in each input dataset and there are no transformations made.
68
+ Get column lineage facet for identity transformations.
69
+
70
+ This function generates a simple column lineage facet, where each destination column
71
+ consists of source columns of the same name from all input datasets that have that column.
72
+ The lineage assumes there are no transformations applied, meaning the columns retain their
73
+ identity between the source and destination datasets.
74
+
75
+ Args:
76
+ dest_field_names: A list of destination column names for which lineage should be determined.
77
+ input_datasets: A list of input datasets with schema facets.
78
+
79
+ Returns:
80
+ A dictionary containing a single key, `columnLineage`, mapped to a `ColumnLineageDatasetFacet`.
81
+ If no column lineage can be determined, an empty dictionary is returned - see Notes below.
82
+
83
+ Notes:
84
+ - If any input dataset lacks a schema facet, the function immediately returns an empty dictionary.
85
+ - If any field in the source dataset's schema is not present in the destination table,
86
+ the function returns an empty dictionary. The destination table can contain extra fields, but all
87
+ source columns should be present in the destination table.
88
+ - If none of the destination columns can be matched to input dataset columns, an empty
89
+ dictionary is returned.
90
+ - Extra columns in the destination table that do not exist in the input datasets are ignored and
91
+ skipped in the lineage facet, as they cannot be traced back to a source column.
92
+ - The function assumes there are no transformations applied, meaning the columns retain their
93
+ identity between the source and destination datasets.
70
94
  """
71
- if field_names and not input_datasets:
72
- raise ValueError("When providing `field_names` You must provide at least one `input_dataset`.")
95
+ fields_sources: dict[str, list[Dataset]] = {}
96
+ for ds in input_datasets:
97
+ if not ds.facets or "schema" not in ds.facets:
98
+ return {}
99
+ for schema_field in ds.facets["schema"].fields: # type: ignore[attr-defined]
100
+ if schema_field.name not in dest_field_names:
101
+ return {}
102
+ fields_sources[schema_field.name] = fields_sources.get(schema_field.name, []) + [ds]
103
+
104
+ if not fields_sources:
105
+ return {}
73
106
 
74
107
  column_lineage_facet = ColumnLineageDatasetFacet(
75
108
  fields={
76
- field: Fields(
109
+ field_name: Fields(
77
110
  inputFields=[
78
- InputField(namespace=dataset.namespace, name=dataset.name, field=field)
79
- for dataset in input_datasets
111
+ InputField(namespace=dataset.namespace, name=dataset.name, field=field_name)
112
+ for dataset in source_datasets
80
113
  ],
81
114
  transformationType="IDENTITY",
82
115
  transformationDescription="identical",
83
116
  )
84
- for field in field_names
117
+ for field_name, source_datasets in fields_sources.items()
85
118
  }
86
119
  )
87
- return column_lineage_facet
120
+ return {"columnLineage": column_lineage_facet}
88
121
 
89
122
 
90
123
  @define
@@ -21,8 +21,9 @@ from __future__ import annotations
21
21
 
22
22
  import ast
23
23
  import warnings
24
+ from collections.abc import Sequence
24
25
  from functools import cached_property
25
- from typing import TYPE_CHECKING, Sequence, Tuple, cast
26
+ from typing import TYPE_CHECKING, cast
26
27
 
27
28
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
29
  from google.cloud.automl_v1beta1 import (
@@ -53,7 +54,7 @@ if TYPE_CHECKING:
53
54
 
54
55
  from airflow.utils.context import Context
55
56
 
56
- MetaData = Sequence[Tuple[str, str]]
57
+ MetaData = Sequence[tuple[str, str]]
57
58
 
58
59
 
59
60
  def _raise_exception_for_deprecated_operator(
@@ -85,7 +86,7 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
85
86
  :class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTabularTrainingJobOperator`,
86
87
  :class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLVideoTrainingJobOperator`,
87
88
  :class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLImageTrainingJobOperator`,
88
- :class:`airflow.providers.google.cloud.operators.vertex_ai.auto_ml.CreateAutoMLTextTrainingJobOperator`,
89
+ :class:`airflow.providers.google.cloud.operators.vertex_ai.generative_model.SupervisedFineTuningTrainOperator`,
89
90
  instead.
90
91
 
91
92
  .. seealso::
@@ -155,7 +156,7 @@ class AutoMLTrainModelOperator(GoogleCloudBaseOperator):
155
156
  "CreateAutoMLTabularTrainingJobOperator",
156
157
  "CreateAutoMLVideoTrainingJobOperator",
157
158
  "CreateAutoMLImageTrainingJobOperator",
158
- "CreateAutoMLTextTrainingJobOperator",
159
+ "SupervisedFineTuningTrainOperator",
159
160
  ],
160
161
  )
161
162
  hook = CloudAutoMLHook(