apache-airflow-providers-google 12.0.0rc2__py3-none-any.whl → 14.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 (163) hide show
  1. airflow/providers/google/LICENSE +0 -52
  2. airflow/providers/google/__init__.py +1 -1
  3. airflow/providers/google/ads/hooks/ads.py +27 -13
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +18 -4
  5. airflow/providers/google/assets/bigquery.py +17 -0
  6. airflow/providers/google/cloud/_internal_client/secret_manager_client.py +2 -3
  7. airflow/providers/google/cloud/hooks/alloy_db.py +736 -8
  8. airflow/providers/google/cloud/hooks/automl.py +10 -4
  9. airflow/providers/google/cloud/hooks/bigquery.py +125 -22
  10. airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
  11. airflow/providers/google/cloud/hooks/bigtable.py +2 -3
  12. airflow/providers/google/cloud/hooks/cloud_batch.py +3 -4
  13. airflow/providers/google/cloud/hooks/cloud_build.py +4 -5
  14. airflow/providers/google/cloud/hooks/cloud_composer.py +3 -4
  15. airflow/providers/google/cloud/hooks/cloud_memorystore.py +3 -4
  16. airflow/providers/google/cloud/hooks/cloud_run.py +3 -4
  17. airflow/providers/google/cloud/hooks/cloud_sql.py +7 -3
  18. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +119 -7
  19. airflow/providers/google/cloud/hooks/compute.py +3 -3
  20. airflow/providers/google/cloud/hooks/datacatalog.py +3 -4
  21. airflow/providers/google/cloud/hooks/dataflow.py +12 -12
  22. airflow/providers/google/cloud/hooks/dataform.py +2 -3
  23. airflow/providers/google/cloud/hooks/datafusion.py +2 -2
  24. airflow/providers/google/cloud/hooks/dataplex.py +1032 -11
  25. airflow/providers/google/cloud/hooks/dataproc.py +4 -5
  26. airflow/providers/google/cloud/hooks/dataproc_metastore.py +3 -4
  27. airflow/providers/google/cloud/hooks/dlp.py +3 -4
  28. airflow/providers/google/cloud/hooks/gcs.py +7 -6
  29. airflow/providers/google/cloud/hooks/kms.py +2 -3
  30. airflow/providers/google/cloud/hooks/kubernetes_engine.py +8 -8
  31. airflow/providers/google/cloud/hooks/life_sciences.py +1 -1
  32. airflow/providers/google/cloud/hooks/managed_kafka.py +482 -0
  33. airflow/providers/google/cloud/hooks/natural_language.py +2 -3
  34. airflow/providers/google/cloud/hooks/os_login.py +2 -3
  35. airflow/providers/google/cloud/hooks/pubsub.py +6 -6
  36. airflow/providers/google/cloud/hooks/secret_manager.py +2 -3
  37. airflow/providers/google/cloud/hooks/spanner.py +2 -2
  38. airflow/providers/google/cloud/hooks/speech_to_text.py +2 -3
  39. airflow/providers/google/cloud/hooks/stackdriver.py +4 -4
  40. airflow/providers/google/cloud/hooks/tasks.py +3 -4
  41. airflow/providers/google/cloud/hooks/text_to_speech.py +2 -3
  42. airflow/providers/google/cloud/hooks/translate.py +236 -5
  43. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +9 -4
  44. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -4
  45. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +4 -5
  46. airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +3 -4
  47. airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -3
  48. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +3 -4
  49. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -181
  50. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -4
  51. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -3
  52. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -4
  53. airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -3
  54. airflow/providers/google/cloud/hooks/video_intelligence.py +2 -3
  55. airflow/providers/google/cloud/hooks/vision.py +3 -4
  56. airflow/providers/google/cloud/hooks/workflows.py +2 -3
  57. airflow/providers/google/cloud/links/alloy_db.py +46 -0
  58. airflow/providers/google/cloud/links/bigquery.py +25 -0
  59. airflow/providers/google/cloud/links/dataplex.py +172 -2
  60. airflow/providers/google/cloud/links/kubernetes_engine.py +1 -2
  61. airflow/providers/google/cloud/links/managed_kafka.py +104 -0
  62. airflow/providers/google/cloud/links/translate.py +28 -0
  63. airflow/providers/google/cloud/log/gcs_task_handler.py +3 -3
  64. airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -10
  65. airflow/providers/google/cloud/openlineage/facets.py +67 -0
  66. airflow/providers/google/cloud/openlineage/mixins.py +438 -173
  67. airflow/providers/google/cloud/openlineage/utils.py +394 -61
  68. airflow/providers/google/cloud/operators/alloy_db.py +980 -69
  69. airflow/providers/google/cloud/operators/automl.py +83 -245
  70. airflow/providers/google/cloud/operators/bigquery.py +377 -74
  71. airflow/providers/google/cloud/operators/bigquery_dts.py +126 -13
  72. airflow/providers/google/cloud/operators/bigtable.py +1 -3
  73. airflow/providers/google/cloud/operators/cloud_base.py +1 -2
  74. airflow/providers/google/cloud/operators/cloud_batch.py +2 -4
  75. airflow/providers/google/cloud/operators/cloud_build.py +3 -5
  76. airflow/providers/google/cloud/operators/cloud_composer.py +5 -7
  77. airflow/providers/google/cloud/operators/cloud_memorystore.py +4 -6
  78. airflow/providers/google/cloud/operators/cloud_run.py +6 -5
  79. airflow/providers/google/cloud/operators/cloud_sql.py +20 -8
  80. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +62 -8
  81. airflow/providers/google/cloud/operators/compute.py +3 -4
  82. airflow/providers/google/cloud/operators/datacatalog.py +9 -11
  83. airflow/providers/google/cloud/operators/dataflow.py +1 -112
  84. airflow/providers/google/cloud/operators/dataform.py +3 -5
  85. airflow/providers/google/cloud/operators/datafusion.py +1 -1
  86. airflow/providers/google/cloud/operators/dataplex.py +2046 -7
  87. airflow/providers/google/cloud/operators/dataproc.py +102 -17
  88. airflow/providers/google/cloud/operators/dataproc_metastore.py +7 -9
  89. airflow/providers/google/cloud/operators/dlp.py +17 -19
  90. airflow/providers/google/cloud/operators/gcs.py +14 -17
  91. airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -2
  92. airflow/providers/google/cloud/operators/managed_kafka.py +788 -0
  93. airflow/providers/google/cloud/operators/natural_language.py +3 -5
  94. airflow/providers/google/cloud/operators/pubsub.py +39 -7
  95. airflow/providers/google/cloud/operators/speech_to_text.py +3 -5
  96. airflow/providers/google/cloud/operators/stackdriver.py +3 -5
  97. airflow/providers/google/cloud/operators/tasks.py +4 -6
  98. airflow/providers/google/cloud/operators/text_to_speech.py +2 -4
  99. airflow/providers/google/cloud/operators/translate.py +414 -5
  100. airflow/providers/google/cloud/operators/translate_speech.py +2 -4
  101. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +9 -8
  102. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +4 -6
  103. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +6 -8
  104. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +4 -6
  105. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +4 -6
  106. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +0 -322
  107. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +4 -6
  108. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +4 -6
  109. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +4 -6
  110. airflow/providers/google/cloud/operators/video_intelligence.py +3 -5
  111. airflow/providers/google/cloud/operators/vision.py +4 -6
  112. airflow/providers/google/cloud/operators/workflows.py +5 -7
  113. airflow/providers/google/cloud/secrets/secret_manager.py +1 -2
  114. airflow/providers/google/cloud/sensors/bigquery_dts.py +3 -5
  115. airflow/providers/google/cloud/sensors/bigtable.py +2 -3
  116. airflow/providers/google/cloud/sensors/cloud_composer.py +32 -8
  117. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +39 -1
  118. airflow/providers/google/cloud/sensors/dataplex.py +4 -6
  119. airflow/providers/google/cloud/sensors/dataproc.py +2 -3
  120. airflow/providers/google/cloud/sensors/dataproc_metastore.py +1 -2
  121. airflow/providers/google/cloud/sensors/gcs.py +2 -4
  122. airflow/providers/google/cloud/sensors/pubsub.py +2 -3
  123. airflow/providers/google/cloud/sensors/workflows.py +3 -5
  124. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +5 -5
  125. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +10 -12
  126. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  127. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +36 -4
  128. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +27 -2
  129. airflow/providers/google/cloud/transfers/mysql_to_gcs.py +27 -2
  130. airflow/providers/google/cloud/transfers/postgres_to_gcs.py +27 -2
  131. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +34 -5
  132. airflow/providers/google/cloud/transfers/sql_to_gcs.py +15 -0
  133. airflow/providers/google/cloud/transfers/trino_to_gcs.py +25 -2
  134. airflow/providers/google/cloud/triggers/bigquery_dts.py +1 -2
  135. airflow/providers/google/cloud/triggers/cloud_batch.py +1 -2
  136. airflow/providers/google/cloud/triggers/cloud_build.py +1 -2
  137. airflow/providers/google/cloud/triggers/cloud_composer.py +13 -3
  138. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +102 -4
  139. airflow/providers/google/cloud/triggers/dataflow.py +2 -3
  140. airflow/providers/google/cloud/triggers/dataplex.py +1 -2
  141. airflow/providers/google/cloud/triggers/dataproc.py +2 -3
  142. airflow/providers/google/cloud/triggers/kubernetes_engine.py +1 -1
  143. airflow/providers/google/cloud/triggers/pubsub.py +1 -2
  144. airflow/providers/google/cloud/triggers/vertex_ai.py +7 -8
  145. airflow/providers/google/cloud/utils/credentials_provider.py +15 -8
  146. airflow/providers/google/cloud/utils/external_token_supplier.py +1 -0
  147. airflow/providers/google/common/auth_backend/google_openid.py +4 -4
  148. airflow/providers/google/common/consts.py +1 -2
  149. airflow/providers/google/common/hooks/base_google.py +8 -7
  150. airflow/providers/google/get_provider_info.py +186 -134
  151. airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -3
  152. airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
  153. airflow/providers/google/marketing_platform/operators/analytics_admin.py +5 -7
  154. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/METADATA +40 -57
  155. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/RECORD +157 -159
  156. airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.py +0 -141
  157. airflow/providers/google/cloud/example_dags/example_looker.py +0 -64
  158. airflow/providers/google/cloud/example_dags/example_presto_to_gcs.py +0 -194
  159. airflow/providers/google/cloud/example_dags/example_salesforce_to_gcs.py +0 -129
  160. airflow/providers/google/marketing_platform/example_dags/__init__.py +0 -16
  161. airflow/providers/google/marketing_platform/example_dags/example_display_video.py +0 -213
  162. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/WHEEL +0 -0
  163. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/entry_points.txt +0 -0
@@ -33,12 +33,6 @@ from functools import cached_property
33
33
  from typing import TYPE_CHECKING, Any
34
34
  from uuid import uuid4
35
35
 
36
- from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
37
- from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
38
- from google.cloud.exceptions import NotFound
39
- from google.cloud.pubsub_v1 import PublisherClient, SubscriberClient
40
- from google.cloud.pubsub_v1.types import PublisherOptions
41
- from google.pubsub_v1.services.subscriber.async_client import SubscriberAsyncClient
42
36
  from googleapiclient.errors import HttpError
43
37
 
44
38
  from airflow.exceptions import AirflowProviderDeprecationWarning
@@ -49,6 +43,12 @@ from airflow.providers.google.common.hooks.base_google import (
49
43
  GoogleBaseHook,
50
44
  )
51
45
  from airflow.version import version
46
+ from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
47
+ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
48
+ from google.cloud.exceptions import NotFound
49
+ from google.cloud.pubsub_v1 import PublisherClient, SubscriberClient
50
+ from google.cloud.pubsub_v1.types import PublisherOptions
51
+ from google.pubsub_v1.services.subscriber.async_client import SubscriberAsyncClient
52
52
 
53
53
  if TYPE_CHECKING:
54
54
  from google.api_core.retry import Retry
@@ -23,6 +23,8 @@ from collections.abc import Sequence
23
23
  from functools import cached_property
24
24
  from typing import TYPE_CHECKING
25
25
 
26
+ from airflow.providers.google.common.consts import CLIENT_INFO
27
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
26
28
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
29
  from google.cloud.secretmanager_v1 import (
28
30
  AccessSecretVersionResponse,
@@ -32,9 +34,6 @@ from google.cloud.secretmanager_v1 import (
32
34
  SecretVersion,
33
35
  )
34
36
 
35
- from airflow.providers.google.common.consts import CLIENT_INFO
36
- from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
37
-
38
37
  if TYPE_CHECKING:
39
38
  from google.api_core.retry import Retry
40
39
  from google.cloud.secretmanager_v1.services.secret_manager_service.pagers import ListSecretsPager
@@ -22,14 +22,14 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING, Callable, NamedTuple
24
24
 
25
- from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
26
- from google.cloud.spanner_v1.client import Client
27
25
  from sqlalchemy import create_engine
28
26
 
29
27
  from airflow.exceptions import AirflowException
30
28
  from airflow.providers.common.sql.hooks.sql import DbApiHook
31
29
  from airflow.providers.google.common.consts import CLIENT_INFO
32
30
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook, get_field
31
+ from google.api_core.exceptions import AlreadyExists, GoogleAPICallError
32
+ from google.cloud.spanner_v1.client import Client
33
33
 
34
34
  if TYPE_CHECKING:
35
35
  from google.cloud.spanner_v1.database import Database
@@ -22,13 +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.google.common.consts import CLIENT_INFO
26
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
25
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
26
28
  from google.cloud.speech_v1 import SpeechClient
27
29
  from google.cloud.speech_v1.types import RecognitionAudio, RecognitionConfig
28
30
 
29
- from airflow.providers.google.common.consts import CLIENT_INFO
30
- from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
31
-
32
31
  if TYPE_CHECKING:
33
32
  from google.api_core.retry import Retry
34
33
 
@@ -24,15 +24,15 @@ import json
24
24
  from collections.abc import Sequence
25
25
  from typing import TYPE_CHECKING, Any
26
26
 
27
+ from googleapiclient.errors import HttpError
28
+
29
+ from airflow.exceptions import AirflowException
30
+ from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
27
31
  from google.api_core.exceptions import InvalidArgument
28
32
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
29
33
  from google.cloud import monitoring_v3
30
34
  from google.cloud.monitoring_v3 import AlertPolicy, NotificationChannel
31
35
  from google.protobuf.field_mask_pb2 import FieldMask
32
- from googleapiclient.errors import HttpError
33
-
34
- from airflow.exceptions import AirflowException
35
- from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
36
36
 
37
37
  if TYPE_CHECKING:
38
38
  from google.api_core.retry import Retry
@@ -22,13 +22,12 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
- from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
26
- from google.cloud.tasks_v2 import CloudTasksClient
27
- from google.cloud.tasks_v2.types import Queue, Task
28
-
29
25
  from airflow.exceptions import AirflowException
30
26
  from airflow.providers.google.common.consts import CLIENT_INFO
31
27
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
28
+ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
29
+ from google.cloud.tasks_v2 import CloudTasksClient
30
+ from google.cloud.tasks_v2.types import Queue, Task
32
31
 
33
32
  if TYPE_CHECKING:
34
33
  from google.api_core.retry import Retry
@@ -22,6 +22,8 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
+ from airflow.providers.google.common.consts import CLIENT_INFO
26
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
25
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
26
28
  from google.cloud.texttospeech_v1 import TextToSpeechClient
27
29
  from google.cloud.texttospeech_v1.types import (
@@ -31,9 +33,6 @@ from google.cloud.texttospeech_v1.types import (
31
33
  VoiceSelectionParams,
32
34
  )
33
35
 
34
- from airflow.providers.google.common.consts import CLIENT_INFO
35
- from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
36
-
37
36
  if TYPE_CHECKING:
38
37
  from google.api_core.retry import Retry
39
38
 
@@ -25,17 +25,19 @@ from typing import (
25
25
  cast,
26
26
  )
27
27
 
28
+ from airflow.exceptions import AirflowException
29
+ from airflow.providers.google.common.consts import CLIENT_INFO
30
+ from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
28
31
  from google.api_core.exceptions import GoogleAPICallError
29
32
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
30
33
  from google.api_core.retry import Retry
31
34
  from google.cloud.translate_v2 import Client
32
35
  from google.cloud.translate_v3 import TranslationServiceClient
33
-
34
- from airflow.exceptions import AirflowException
35
- from airflow.providers.google.common.consts import CLIENT_INFO
36
- from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
36
+ from google.cloud.translate_v3.types.translation_service import GlossaryInputConfig
37
37
 
38
38
  if TYPE_CHECKING:
39
+ from proto import Message
40
+
39
41
  from google.api_core.operation import Operation
40
42
  from google.cloud.translate_v3.services.translation_service import pagers
41
43
  from google.cloud.translate_v3.types import (
@@ -51,7 +53,7 @@ if TYPE_CHECKING:
51
53
  TransliterationConfig,
52
54
  automl_translation,
53
55
  )
54
- from proto import Message
56
+ from google.cloud.translate_v3.types.translation_service import Glossary
55
57
 
56
58
 
57
59
  class WaitOperationNotDoneYetError(Exception):
@@ -915,3 +917,232 @@ class TranslateHook(GoogleBaseHook):
915
917
  retry=retry,
916
918
  metadata=metadata,
917
919
  )
920
+
921
+ def create_glossary(
922
+ self,
923
+ project_id: str,
924
+ location: str,
925
+ glossary_id: str,
926
+ input_config: GlossaryInputConfig | dict,
927
+ language_pair: Glossary.LanguageCodePair | dict | None = None,
928
+ language_codes_set: Glossary.LanguageCodesSet | MutableSequence[str] | None = None,
929
+ retry: Retry | _MethodDefault = DEFAULT,
930
+ timeout: float | None = None,
931
+ metadata: Sequence[tuple[str, str]] = (),
932
+ ) -> Operation:
933
+ """
934
+ Create the glossary resource from the input source file.
935
+
936
+ :param project_id: ID of the Google Cloud project where dataset is located. If not provided
937
+ default project_id is used.
938
+ :param location: The location of the project.
939
+ :param glossary_id: User-specified id to built glossary resource name.
940
+ :param input_config: The input configuration of examples to built glossary from.
941
+ Total glossary must not exceed 10M Unicode codepoints.
942
+ The headers should not be included into the input file table, as languages specified with the
943
+ ``language_pair`` or ``language_codes_set`` params.
944
+ :param language_pair: Pair of language codes to be used for glossary creation.
945
+ Used to built unidirectional glossary. If specified, the ``language_codes_set`` should be empty.
946
+ :param language_codes_set: Set of language codes to create the equivalent term sets glossary.
947
+ Meant multiple languages mapping. If specified, the ``language_pair`` should be empty.
948
+ :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
949
+ retried.
950
+ :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
951
+ `retry` is specified, the timeout applies to each individual attempt.
952
+ :param metadata: Additional metadata that is provided to the method.
953
+
954
+ :return: `Operation` object with the glossary creation results.
955
+ """
956
+ client = self.get_client()
957
+ parent = f"projects/{project_id}/locations/{location}"
958
+ name = f"projects/{project_id}/locations/{location}/glossaries/{glossary_id}"
959
+
960
+ result = client.create_glossary(
961
+ request={
962
+ "parent": parent,
963
+ "glossary": {
964
+ "name": name,
965
+ "input_config": input_config,
966
+ "language_pair": language_pair,
967
+ "language_codes_set": language_codes_set,
968
+ },
969
+ },
970
+ retry=retry,
971
+ timeout=timeout,
972
+ metadata=metadata,
973
+ )
974
+ return result
975
+
976
+ def get_glossary(
977
+ self,
978
+ project_id: str,
979
+ location: str,
980
+ glossary_id: str,
981
+ retry: Retry | _MethodDefault = DEFAULT,
982
+ timeout: float | None = None,
983
+ metadata: Sequence[tuple[str, str]] = (),
984
+ ) -> Glossary:
985
+ """
986
+ Fetch glossary item data by the given id.
987
+
988
+ The glossary_id is a substring of glossary name, following the format:
989
+ ``projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}``
990
+
991
+ :param project_id: ID of the Google Cloud project where dataset is located. If not provided
992
+ default project_id is used.
993
+ :param location: The location of the project.
994
+ :param glossary_id: User-specified id to built glossary resource name.
995
+ :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
996
+ retried.
997
+ :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
998
+ `retry` is specified, the timeout applies to each individual attempt.
999
+ :param metadata: Additional metadata that is provided to the method.
1000
+
1001
+ :return: Fetched glossary item.
1002
+ """
1003
+ client = self.get_client()
1004
+ name = f"projects/{project_id}/locations/{location}/glossaries/{glossary_id}"
1005
+ result = client.get_glossary(
1006
+ name=name,
1007
+ retry=retry,
1008
+ timeout=timeout,
1009
+ metadata=metadata,
1010
+ )
1011
+ if not result:
1012
+ raise AirflowException(f"Fail to get glossary {name}! Please check if it exists.")
1013
+ return result
1014
+
1015
+ def update_glossary(
1016
+ self,
1017
+ glossary: Glossary,
1018
+ new_display_name: str | None = None,
1019
+ new_input_config: GlossaryInputConfig | dict | None = None,
1020
+ retry: Retry | _MethodDefault = DEFAULT,
1021
+ timeout: float | None = None,
1022
+ metadata: Sequence[tuple[str, str]] = (),
1023
+ ) -> Operation:
1024
+ """
1025
+ Update glossary item with values provided.
1026
+
1027
+ Only ``display_name`` and ``input_config`` fields are allowed for update.
1028
+
1029
+ :param glossary: Glossary item to update.
1030
+ :param new_display_name: New value of the ``display_name`` to be updated.
1031
+ :param new_input_config: New value of the ``input_config`` to be updated.
1032
+ :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
1033
+ retried.
1034
+ :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
1035
+ `retry` is specified, the timeout applies to each individual attempt.
1036
+ :param metadata: Additional metadata that is provided to the method.
1037
+
1038
+ :return: `Operation` with glossary update results.
1039
+ """
1040
+ client = self.get_client()
1041
+ updated_fields = []
1042
+ if new_display_name:
1043
+ glossary.display_name = new_display_name
1044
+ updated_fields.append("display_name")
1045
+ if new_input_config is not None:
1046
+ if isinstance(new_input_config, dict):
1047
+ new_input_config = GlossaryInputConfig(**new_input_config)
1048
+ glossary.input_config = new_input_config
1049
+ updated_fields.append("input_config")
1050
+ result = client.update_glossary(
1051
+ request={"glossary": glossary, "update_mask": {"paths": updated_fields}},
1052
+ retry=retry,
1053
+ timeout=timeout,
1054
+ metadata=metadata,
1055
+ )
1056
+ return result
1057
+
1058
+ def list_glossaries(
1059
+ self,
1060
+ project_id: str,
1061
+ location: str,
1062
+ page_size: int | None = None,
1063
+ page_token: str | None = None,
1064
+ filter_str: str | None = None,
1065
+ retry: Retry | _MethodDefault = DEFAULT,
1066
+ timeout: float | None = None,
1067
+ metadata: Sequence[tuple[str, str]] = (),
1068
+ ) -> pagers.ListGlossariesPager:
1069
+ """
1070
+ Get the list of glossaries available.
1071
+
1072
+ :param project_id: ID of the Google Cloud project where dataset is located. If not provided
1073
+ default project_id is used.
1074
+ :param location: The location of the project.
1075
+ :param page_size: Page size requested, if not set server use appropriate default.
1076
+ :param page_token: A token identifying a page of results the server should return.
1077
+ The first page is returned if ``page_token`` is empty or missing.
1078
+ :param filter_str: Filter specifying constraints of a list operation. Specify the constraint by the
1079
+ format of "key=value", where key must be ``src`` or ``tgt``, and the value must be a valid
1080
+ language code.
1081
+ For multiple restrictions, concatenate them by "AND" (uppercase only), such as:
1082
+ ``src=en-US AND tgt=zh-CN``. Notice that the exact match is used here, which means using 'en-US'
1083
+ and 'en' can lead to different results, which depends on the language code you used when you
1084
+ create the glossary.
1085
+ For the unidirectional glossaries, the ``src`` and ``tgt`` add restrictions
1086
+ on the source and target language code separately.
1087
+ For the equivalent term set glossaries, the ``src`` and/or ``tgt`` add restrictions on the term set.
1088
+ For example: ``src=en-US AND tgt=zh-CN`` will only pick the unidirectional glossaries which exactly
1089
+ match the source language code as ``en-US`` and the target language code ``zh-CN``, but all
1090
+ equivalent term set glossaries which contain ``en-US`` and ``zh-CN`` in their language set will
1091
+ be picked.
1092
+ If missing, no filtering is performed.
1093
+ :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
1094
+ retried.
1095
+ :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
1096
+ `retry` is specified, the timeout applies to each individual attempt.
1097
+ :param metadata: Additional metadata that is provided to the method.
1098
+
1099
+ :return: Glossaries list pager object.
1100
+ """
1101
+ client = self.get_client()
1102
+ parent = f"projects/{project_id}/locations/{location}"
1103
+ result = client.list_glossaries(
1104
+ request={
1105
+ "parent": parent,
1106
+ "page_size": page_size,
1107
+ "page_token": page_token,
1108
+ "filter": filter_str,
1109
+ },
1110
+ retry=retry,
1111
+ timeout=timeout,
1112
+ metadata=metadata,
1113
+ )
1114
+ return result
1115
+
1116
+ def delete_glossary(
1117
+ self,
1118
+ project_id: str,
1119
+ location: str,
1120
+ glossary_id: str,
1121
+ retry: Retry | _MethodDefault = DEFAULT,
1122
+ timeout: float | None = None,
1123
+ metadata: Sequence[tuple[str, str]] = (),
1124
+ ) -> Operation:
1125
+ """
1126
+ Delete the glossary item by the given id.
1127
+
1128
+ :param project_id: ID of the Google Cloud project where dataset is located. If not provided
1129
+ default project_id is used.
1130
+ :param location: The location of the project.
1131
+ :param glossary_id: Glossary id to be deleted.
1132
+ :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
1133
+ retried.
1134
+ :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
1135
+ `retry` is specified, the timeout applies to each individual attempt.
1136
+ :param metadata: Additional metadata that is provided to the method.
1137
+
1138
+ :return: `Operation` with glossary deletion results.
1139
+ """
1140
+ client = self.get_client()
1141
+ name = f"projects/{project_id}/locations/{location}/glossaries/{glossary_id}"
1142
+ result = client.delete_glossary(
1143
+ name=name,
1144
+ retry=retry,
1145
+ timeout=timeout,
1146
+ metadata=metadata,
1147
+ )
1148
+ return result
@@ -23,6 +23,9 @@ import warnings
23
23
  from collections.abc import Sequence
24
24
  from typing import TYPE_CHECKING
25
25
 
26
+ from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
27
+ from airflow.providers.google.common.deprecated import deprecated
28
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
26
29
  from google.api_core.client_options import ClientOptions
27
30
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
31
  from google.cloud.aiplatform import (
@@ -36,10 +39,6 @@ from google.cloud.aiplatform import (
36
39
  )
37
40
  from google.cloud.aiplatform_v1 import JobServiceClient, PipelineServiceClient
38
41
 
39
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
40
- from airflow.providers.google.common.deprecated import deprecated
41
- from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
42
-
43
42
  if TYPE_CHECKING:
44
43
  from google.api_core.operation import Operation
45
44
  from google.api_core.retry import Retry
@@ -561,6 +560,7 @@ class AutoMLHook(GoogleBaseHook):
561
560
  model_version_description: str | None = None,
562
561
  window_stride_length: int | None = None,
563
562
  window_max_count: int | None = None,
563
+ holiday_regions: list[str] | None = None,
564
564
  ) -> tuple[models.Model | None, str]:
565
565
  """
566
566
  Create an AutoML Forecasting Training Job.
@@ -717,6 +717,10 @@ class AutoMLHook(GoogleBaseHook):
717
717
  ``window_stride_length`` rows will be used to generate a sliding window.
718
718
  :param window_max_count: Optional. Number of rows that should be used to generate input examples. If the
719
719
  total row count is larger than this number, the input data will be randomly sampled to hit the count.
720
+ :param holiday_regions: Optional. You can select one or more geographical
721
+ regions to enable holiday effect modeling. During training, Vertex AI
722
+ creates holiday categorical features within the model based on the date
723
+ from TIME_COLUMN and the specified geographical regions.
720
724
  """
721
725
  if column_transformations:
722
726
  warnings.warn(
@@ -774,6 +778,7 @@ class AutoMLHook(GoogleBaseHook):
774
778
  model_version_description=model_version_description,
775
779
  window_stride_length=window_stride_length,
776
780
  window_max_count=window_max_count,
781
+ holiday_regions=holiday_regions,
777
782
  )
778
783
  training_id = self.extract_training_id(self._job.resource_name)
779
784
  if model:
@@ -23,15 +23,14 @@ import asyncio
23
23
  from collections.abc import Sequence
24
24
  from typing import TYPE_CHECKING
25
25
 
26
+ from airflow.exceptions import AirflowException
27
+ from airflow.providers.google.common.consts import CLIENT_INFO
28
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
26
29
  from google.api_core.client_options import ClientOptions
27
30
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
31
  from google.cloud.aiplatform import BatchPredictionJob, Model, explain
29
32
  from google.cloud.aiplatform_v1 import JobServiceAsyncClient, JobServiceClient, JobState, types
30
33
 
31
- from airflow.exceptions import AirflowException
32
- from airflow.providers.google.common.consts import CLIENT_INFO
33
- from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
34
-
35
34
  if TYPE_CHECKING:
36
35
  from google.api_core.operation import Operation
37
36
  from google.api_core.retry import AsyncRetry, Retry
@@ -23,6 +23,10 @@ import asyncio
23
23
  from collections.abc import Sequence
24
24
  from typing import TYPE_CHECKING, Any
25
25
 
26
+ from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
27
+ from airflow.providers.google.common.consts import CLIENT_INFO
28
+ from airflow.providers.google.common.deprecated import deprecated
29
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
26
30
  from google.api_core.client_options import ClientOptions
27
31
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
28
32
  from google.cloud.aiplatform import (
@@ -42,11 +46,6 @@ from google.cloud.aiplatform_v1 import (
42
46
  types,
43
47
  )
44
48
 
45
- from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
46
- from airflow.providers.google.common.consts import CLIENT_INFO
47
- from airflow.providers.google.common.deprecated import deprecated
48
- from airflow.providers.google.common.hooks.base_google import GoogleBaseAsyncHook, GoogleBaseHook
49
-
50
49
  if TYPE_CHECKING:
51
50
  from google.api_core.operation import Operation
52
51
  from google.api_core.retry import AsyncRetry, Retry
@@ -22,13 +22,12 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING
24
24
 
25
- from google.api_core.client_options import ClientOptions
26
- from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
- from google.cloud.aiplatform_v1 import DatasetServiceClient
28
-
29
25
  from airflow.exceptions import AirflowException
30
26
  from airflow.providers.google.common.consts import CLIENT_INFO
31
27
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
28
+ from google.api_core.client_options import ClientOptions
29
+ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
30
+ from google.cloud.aiplatform_v1 import DatasetServiceClient
32
31
 
33
32
  if TYPE_CHECKING:
34
33
  from google.api_core.operation import Operation
@@ -22,13 +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.exceptions import AirflowException
26
+ from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
25
27
  from google.api_core.client_options import ClientOptions
26
28
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
29
  from google.cloud.aiplatform_v1 import EndpointServiceClient
28
30
 
29
- from airflow.exceptions import AirflowException
30
- from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
31
-
32
31
  if TYPE_CHECKING:
33
32
  from google.api_core.operation import Operation
34
33
  from google.api_core.retry import Retry
@@ -18,15 +18,14 @@
18
18
 
19
19
  from __future__ import annotations
20
20
 
21
+ from airflow.exceptions import AirflowException
22
+ from airflow.providers.google.common.consts import CLIENT_INFO
23
+ from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
21
24
  from google.api_core.client_options import ClientOptions
22
25
  from google.cloud.aiplatform_v1beta1 import (
23
26
  FeatureOnlineStoreAdminServiceClient,
24
27
  )
25
28
 
26
- from airflow.exceptions import AirflowException
27
- from airflow.providers.google.common.consts import CLIENT_INFO
28
- from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
29
-
30
29
 
31
30
  class FeatureStoreHook(GoogleBaseHook):
32
31
  """