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
@@ -1,673 +0,0 @@
1
- #
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- """
19
- This module contains a Google AutoML hook.
20
-
21
- .. spelling:word-list::
22
-
23
- PredictResponse
24
- """
25
-
26
- from __future__ import annotations
27
-
28
- from collections.abc import Sequence
29
- from functools import cached_property
30
- from typing import TYPE_CHECKING
31
-
32
- from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
33
- from google.cloud.automl_v1beta1 import (
34
- AutoMlClient,
35
- BatchPredictInputConfig,
36
- BatchPredictOutputConfig,
37
- Dataset,
38
- ExamplePayload,
39
- ImageObjectDetectionModelDeploymentMetadata,
40
- InputConfig,
41
- Model,
42
- PredictionServiceClient,
43
- PredictResponse,
44
- )
45
-
46
- from airflow.exceptions import AirflowProviderDeprecationWarning
47
- from airflow.providers.google.common.consts import CLIENT_INFO
48
- from airflow.providers.google.common.deprecated import deprecated
49
- from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
50
- from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
51
-
52
- if TYPE_CHECKING:
53
- from google.api_core.operation import Operation
54
- from google.api_core.retry import Retry
55
- from google.cloud.automl_v1beta1.services.auto_ml.pagers import (
56
- ListColumnSpecsPager,
57
- ListDatasetsPager,
58
- ListTableSpecsPager,
59
- )
60
- from google.protobuf.field_mask_pb2 import FieldMask
61
-
62
-
63
- @deprecated(
64
- planned_removal_date="September 30, 2025",
65
- use_instead="airflow.providers.google.cloud.hooks.vertex_ai.auto_ml.AutoMLHook, "
66
- "airflow.providers.google.cloud.hooks.translate.TranslateHook",
67
- category=AirflowProviderDeprecationWarning,
68
- )
69
- class CloudAutoMLHook(GoogleBaseHook, OperationHelper):
70
- """
71
- Google Cloud AutoML hook.
72
-
73
- All the methods in the hook where project_id is used must be called with
74
- keyword arguments rather than positional.
75
- """
76
-
77
- def __init__(
78
- self,
79
- gcp_conn_id: str = "google_cloud_default",
80
- impersonation_chain: str | Sequence[str] | None = None,
81
- **kwargs,
82
- ) -> None:
83
- super().__init__(
84
- gcp_conn_id=gcp_conn_id,
85
- impersonation_chain=impersonation_chain,
86
- **kwargs,
87
- )
88
- self._client: AutoMlClient | None = None
89
-
90
- @staticmethod
91
- def extract_object_id(obj: dict) -> str:
92
- """Return unique id of the object."""
93
- return obj["name"].rpartition("/")[-1]
94
-
95
- def get_conn(self) -> AutoMlClient:
96
- """
97
- Retrieve connection to AutoML.
98
-
99
- :return: Google Cloud AutoML client object.
100
- """
101
- if self._client is None:
102
- self._client = AutoMlClient(credentials=self.get_credentials(), client_info=CLIENT_INFO)
103
- return self._client
104
-
105
- @cached_property
106
- def prediction_client(self) -> PredictionServiceClient:
107
- """
108
- Creates PredictionServiceClient.
109
-
110
- :return: Google Cloud AutoML PredictionServiceClient client object.
111
- """
112
- return PredictionServiceClient(credentials=self.get_credentials(), client_info=CLIENT_INFO)
113
-
114
- @GoogleBaseHook.fallback_to_default_project_id
115
- def create_model(
116
- self,
117
- model: dict | Model,
118
- location: str,
119
- project_id: str = PROVIDE_PROJECT_ID,
120
- timeout: float | None = None,
121
- metadata: Sequence[tuple[str, str]] = (),
122
- retry: Retry | _MethodDefault = DEFAULT,
123
- ) -> Operation:
124
- """
125
- Create a model_id and returns a Model in the `response` field when it completes.
126
-
127
- When you create a model, several model evaluations are created for it:
128
- a global evaluation, and one evaluation for each annotation spec.
129
-
130
- :param model: The model_id to create. If a dict is provided, it must be of the same form
131
- as the protobuf message `google.cloud.automl_v1beta1.types.Model`
132
- :param project_id: ID of the Google Cloud project where model will be created if None then
133
- default project_id is used.
134
- :param location: The location of the project.
135
- :param retry: A retry object used to retry requests. If `None` is specified, requests
136
- will not be retried.
137
- :param timeout: The amount of time, in seconds, to wait for the request to complete.
138
- Note that if `retry` is specified, the timeout applies to each individual attempt.
139
- :param metadata: Additional metadata that is provided to the method.
140
-
141
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance
142
- """
143
- client = self.get_conn()
144
- parent = f"projects/{project_id}/locations/{location}"
145
- return client.create_model(
146
- request={"parent": parent, "model": model},
147
- retry=retry,
148
- timeout=timeout,
149
- metadata=metadata,
150
- )
151
-
152
- @GoogleBaseHook.fallback_to_default_project_id
153
- def batch_predict(
154
- self,
155
- model_id: str,
156
- input_config: dict | BatchPredictInputConfig,
157
- output_config: dict | BatchPredictOutputConfig,
158
- location: str,
159
- project_id: str = PROVIDE_PROJECT_ID,
160
- params: dict[str, str] | None = None,
161
- retry: Retry | _MethodDefault = DEFAULT,
162
- timeout: float | None = None,
163
- metadata: Sequence[tuple[str, str]] = (),
164
- ) -> Operation:
165
- """
166
- Perform a batch prediction and returns a long-running operation object.
167
-
168
- Unlike the online `Predict`, batch prediction result won't be immediately
169
- available in the response. Instead, a long-running operation object is returned.
170
-
171
- :param model_id: Name of the model_id requested to serve the batch prediction.
172
- :param input_config: Required. The input configuration for batch prediction.
173
- If a dict is provided, it must be of the same form as the protobuf message
174
- `google.cloud.automl_v1beta1.types.BatchPredictInputConfig`
175
- :param output_config: Required. The Configuration specifying where output predictions should be
176
- written. If a dict is provided, it must be of the same form as the protobuf message
177
- `google.cloud.automl_v1beta1.types.BatchPredictOutputConfig`
178
- :param params: Additional domain-specific parameters for the predictions, any string must be up to
179
- 25000 characters long.
180
- :param project_id: ID of the Google Cloud project where model is located if None then
181
- default project_id is used.
182
- :param location: The location of the project.
183
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
184
- retried.
185
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
186
- `retry` is specified, the timeout applies to each individual attempt.
187
- :param metadata: Additional metadata that is provided to the method.
188
-
189
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance
190
- """
191
- client = self.prediction_client
192
- name = f"projects/{project_id}/locations/{location}/models/{model_id}"
193
- result = client.batch_predict(
194
- request={
195
- "name": name,
196
- "input_config": input_config,
197
- "output_config": output_config,
198
- "params": params,
199
- },
200
- retry=retry,
201
- timeout=timeout,
202
- metadata=metadata,
203
- )
204
- return result
205
-
206
- @GoogleBaseHook.fallback_to_default_project_id
207
- def predict(
208
- self,
209
- model_id: str,
210
- payload: dict | ExamplePayload,
211
- location: str,
212
- project_id: str = PROVIDE_PROJECT_ID,
213
- params: dict[str, str] | None = None,
214
- retry: Retry | _MethodDefault = DEFAULT,
215
- timeout: float | None = None,
216
- metadata: Sequence[tuple[str, str]] = (),
217
- ) -> PredictResponse:
218
- """
219
- Perform an online prediction and returns the prediction result in the response.
220
-
221
- :param model_id: Name of the model_id requested to serve the prediction.
222
- :param payload: Required. Payload to perform a prediction on. The payload must match the problem type
223
- that the model_id was trained to solve. If a dict is provided, it must be of
224
- the same form as the protobuf message `google.cloud.automl_v1beta1.types.ExamplePayload`
225
- :param params: Additional domain-specific parameters, any string must be up to 25000 characters long.
226
- :param project_id: ID of the Google Cloud project where model is located if None then
227
- default project_id is used.
228
- :param location: The location of the project.
229
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
230
- retried.
231
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
232
- `retry` is specified, the timeout applies to each individual attempt.
233
- :param metadata: Additional metadata that is provided to the method.
234
-
235
- :return: `google.cloud.automl_v1beta1.types.PredictResponse` instance
236
- """
237
- client = self.prediction_client
238
- name = f"projects/{project_id}/locations/{location}/models/{model_id}"
239
- result = client.predict(
240
- request={"name": name, "payload": payload, "params": params},
241
- retry=retry,
242
- timeout=timeout,
243
- metadata=metadata,
244
- )
245
- return result
246
-
247
- @GoogleBaseHook.fallback_to_default_project_id
248
- def create_dataset(
249
- self,
250
- dataset: dict | Dataset,
251
- location: str,
252
- project_id: str = PROVIDE_PROJECT_ID,
253
- retry: Retry | _MethodDefault = DEFAULT,
254
- timeout: float | None = None,
255
- metadata: Sequence[tuple[str, str]] = (),
256
- ) -> Dataset:
257
- """
258
- Create a dataset.
259
-
260
- :param dataset: The dataset to create. If a dict is provided, it must be of the
261
- same form as the protobuf message Dataset.
262
- :param project_id: ID of the Google Cloud project where dataset is located if None then
263
- default project_id is used.
264
- :param location: The location of the project.
265
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
266
- retried.
267
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
268
- `retry` is specified, the timeout applies to each individual attempt.
269
- :param metadata: Additional metadata that is provided to the method.
270
-
271
- :return: `google.cloud.automl_v1beta1.types.Dataset` instance.
272
- """
273
- client = self.get_conn()
274
- parent = f"projects/{project_id}/locations/{location}"
275
- result = client.create_dataset(
276
- request={"parent": parent, "dataset": dataset},
277
- retry=retry,
278
- timeout=timeout,
279
- metadata=metadata,
280
- )
281
- return result
282
-
283
- @GoogleBaseHook.fallback_to_default_project_id
284
- def import_data(
285
- self,
286
- dataset_id: str,
287
- location: str,
288
- input_config: dict | InputConfig,
289
- project_id: str = PROVIDE_PROJECT_ID,
290
- retry: Retry | _MethodDefault = DEFAULT,
291
- timeout: float | None = None,
292
- metadata: Sequence[tuple[str, str]] = (),
293
- ) -> Operation:
294
- """
295
- Import data into a dataset. For Tables this method can only be called on an empty Dataset.
296
-
297
- :param dataset_id: Name of the AutoML dataset.
298
- :param input_config: The desired input location and its domain specific semantics, if any.
299
- If a dict is provided, it must be of the same form as the protobuf message InputConfig.
300
- :param project_id: ID of the Google Cloud project where dataset is located if None then
301
- default project_id is used.
302
- :param location: The location of the project.
303
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
304
- retried.
305
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
306
- `retry` is specified, the timeout applies to each individual attempt.
307
- :param metadata: Additional metadata that is provided to the method.
308
-
309
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance
310
- """
311
- client = self.get_conn()
312
- name = f"projects/{project_id}/locations/{location}/datasets/{dataset_id}"
313
- result = client.import_data(
314
- request={"name": name, "input_config": input_config},
315
- retry=retry,
316
- timeout=timeout,
317
- metadata=metadata,
318
- )
319
- return result
320
-
321
- @GoogleBaseHook.fallback_to_default_project_id
322
- def list_column_specs(
323
- self,
324
- dataset_id: str,
325
- table_spec_id: str,
326
- location: str,
327
- project_id: str = PROVIDE_PROJECT_ID,
328
- field_mask: dict | FieldMask | None = None,
329
- filter_: str | None = None,
330
- page_size: int | None = None,
331
- retry: Retry | _MethodDefault = DEFAULT,
332
- timeout: float | None = None,
333
- metadata: Sequence[tuple[str, str]] = (),
334
- ) -> ListColumnSpecsPager:
335
- """
336
- List column specs in a table spec.
337
-
338
- :param dataset_id: Name of the AutoML dataset.
339
- :param table_spec_id: table_spec_id for path builder.
340
- :param field_mask: Mask specifying which fields to read. If a dict is provided, it must be of the same
341
- form as the protobuf message `google.cloud.automl_v1beta1.types.FieldMask`
342
- :param filter_: Filter expression, see go/filtering.
343
- :param page_size: The maximum number of resources contained in the
344
- underlying API response. If page streaming is performed per
345
- resource, this parameter does not affect the return value. If page
346
- streaming is performed per-page, this determines the maximum number
347
- of resources in a page.
348
- :param project_id: ID of the Google Cloud project where dataset is located if None then
349
- default project_id is used.
350
- :param location: The location of the project.
351
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
352
- retried.
353
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
354
- `retry` is specified, the timeout applies to each individual attempt.
355
- :param metadata: Additional metadata that is provided to the method.
356
-
357
- :return: `google.cloud.automl_v1beta1.types.ColumnSpec` instance.
358
- """
359
- client = self.get_conn()
360
- parent = client.table_spec_path(
361
- project=project_id,
362
- location=location,
363
- dataset=dataset_id,
364
- table_spec=table_spec_id,
365
- )
366
- result = client.list_column_specs(
367
- request={"parent": parent, "field_mask": field_mask, "filter": filter_, "page_size": page_size},
368
- retry=retry,
369
- timeout=timeout,
370
- metadata=metadata,
371
- )
372
- return result
373
-
374
- @GoogleBaseHook.fallback_to_default_project_id
375
- def get_model(
376
- self,
377
- model_id: str,
378
- location: str,
379
- project_id: str = PROVIDE_PROJECT_ID,
380
- retry: Retry | _MethodDefault = DEFAULT,
381
- timeout: float | None = None,
382
- metadata: Sequence[tuple[str, str]] = (),
383
- ) -> Model:
384
- """
385
- Get a AutoML model.
386
-
387
- :param model_id: Name of the model.
388
- :param project_id: ID of the Google Cloud project where model is located if None then
389
- default project_id is used.
390
- :param location: The location of the project.
391
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
392
- retried.
393
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
394
- `retry` is specified, the timeout applies to each individual attempt.
395
- :param metadata: Additional metadata that is provided to the method.
396
-
397
- :return: `google.cloud.automl_v1beta1.types.Model` instance.
398
- """
399
- client = self.get_conn()
400
- name = f"projects/{project_id}/locations/{location}/models/{model_id}"
401
- result = client.get_model(
402
- request={"name": name},
403
- retry=retry,
404
- timeout=timeout,
405
- metadata=metadata,
406
- )
407
- return result
408
-
409
- @GoogleBaseHook.fallback_to_default_project_id
410
- def delete_model(
411
- self,
412
- model_id: str,
413
- location: str,
414
- project_id: str = PROVIDE_PROJECT_ID,
415
- retry: Retry | _MethodDefault = DEFAULT,
416
- timeout: float | None = None,
417
- metadata: Sequence[tuple[str, str]] = (),
418
- ) -> Operation:
419
- """
420
- Delete a AutoML model.
421
-
422
- :param model_id: Name of the model.
423
- :param project_id: ID of the Google Cloud project where model is located if None then
424
- default project_id is used.
425
- :param location: The location of the project.
426
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
427
- retried.
428
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
429
- `retry` is specified, the timeout applies to each individual attempt.
430
- :param metadata: Additional metadata that is provided to the method.
431
-
432
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance.
433
- """
434
- client = self.get_conn()
435
- name = f"projects/{project_id}/locations/{location}/models/{model_id}"
436
- result = client.delete_model(
437
- request={"name": name},
438
- retry=retry,
439
- timeout=timeout,
440
- metadata=metadata,
441
- )
442
- return result
443
-
444
- def update_dataset(
445
- self,
446
- dataset: dict | Dataset,
447
- update_mask: dict | FieldMask | None = None,
448
- retry: Retry | _MethodDefault = DEFAULT,
449
- timeout: float | None = None,
450
- metadata: Sequence[tuple[str, str]] = (),
451
- ) -> Dataset:
452
- """
453
- Update a dataset.
454
-
455
- :param dataset: The dataset which replaces the resource on the server.
456
- If a dict is provided, it must be of the same form as the protobuf message Dataset.
457
- :param update_mask: The update mask applies to the resource. If a dict is provided, it must
458
- be of the same form as the protobuf message FieldMask.
459
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
460
- retried.
461
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
462
- `retry` is specified, the timeout applies to each individual attempt.
463
- :param metadata: Additional metadata that is provided to the method.
464
-
465
- :return: `google.cloud.automl_v1beta1.types.Dataset` instance..
466
- """
467
- client = self.get_conn()
468
- result = client.update_dataset(
469
- request={"dataset": dataset, "update_mask": update_mask},
470
- retry=retry,
471
- timeout=timeout,
472
- metadata=metadata,
473
- )
474
- return result
475
-
476
- @GoogleBaseHook.fallback_to_default_project_id
477
- def deploy_model(
478
- self,
479
- model_id: str,
480
- location: str,
481
- project_id: str = PROVIDE_PROJECT_ID,
482
- image_detection_metadata: ImageObjectDetectionModelDeploymentMetadata | dict | None = None,
483
- retry: Retry | _MethodDefault = DEFAULT,
484
- timeout: float | None = None,
485
- metadata: Sequence[tuple[str, str]] = (),
486
- ) -> Operation:
487
- """
488
- Deploys a model.
489
-
490
- If a model is already deployed, deploying it with the same parameters
491
- has no effect. Deploying with different parameters (as e.g. changing node_number) will
492
- reset the deployment state without pausing the model_id's availability.
493
-
494
- Only applicable for Text Classification, Image Object Detection and Tables; all other
495
- domains manage deployment automatically.
496
-
497
- :param model_id: Name of the model requested to serve the prediction.
498
- :param image_detection_metadata: Model deployment metadata specific to Image Object Detection.
499
- If a dict is provided, it must be of the same form as the protobuf message
500
- ImageObjectDetectionModelDeploymentMetadata
501
- :param project_id: ID of the Google Cloud project where model will be created if None then
502
- default project_id is used.
503
- :param location: The location of the project.
504
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
505
- retried.
506
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
507
- `retry` is specified, the timeout applies to each individual attempt.
508
- :param metadata: Additional metadata that is provided to the method.
509
-
510
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance.
511
- """
512
- client = self.get_conn()
513
- name = f"projects/{project_id}/locations/{location}/models/{model_id}"
514
- result = client.deploy_model(
515
- request={
516
- "name": name,
517
- "image_object_detection_model_deployment_metadata": image_detection_metadata,
518
- },
519
- retry=retry,
520
- timeout=timeout,
521
- metadata=metadata,
522
- )
523
- return result
524
-
525
- def list_table_specs(
526
- self,
527
- dataset_id: str,
528
- location: str,
529
- project_id: str = PROVIDE_PROJECT_ID,
530
- filter_: str | None = None,
531
- page_size: int | None = None,
532
- retry: Retry | _MethodDefault = DEFAULT,
533
- timeout: float | None = None,
534
- metadata: Sequence[tuple[str, str]] = (),
535
- ) -> ListTableSpecsPager:
536
- """
537
- List table specs in a dataset_id.
538
-
539
- :param dataset_id: Name of the dataset.
540
- :param filter_: Filter expression, see go/filtering.
541
- :param page_size: The maximum number of resources contained in the
542
- underlying API response. If page streaming is performed per
543
- resource, this parameter does not affect the return value. If page
544
- streaming is performed per-page, this determines the maximum number
545
- of resources in a page.
546
- :param project_id: ID of the Google Cloud project where dataset is located if None then
547
- default project_id is used.
548
- :param location: The location of the project.
549
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
550
- retried.
551
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
552
- `retry` is specified, the timeout applies to each individual attempt.
553
- :param metadata: Additional metadata that is provided to the method.
554
-
555
- :return: A `google.gax.PageIterator` instance. By default, this
556
- is an iterable of `google.cloud.automl_v1beta1.types.TableSpec` instances.
557
- This object can also be configured to iterate over the pages
558
- of the response through the `options` parameter.
559
- """
560
- client = self.get_conn()
561
- parent = f"projects/{project_id}/locations/{location}/datasets/{dataset_id}"
562
- result = client.list_table_specs(
563
- request={"parent": parent, "filter": filter_, "page_size": page_size},
564
- retry=retry,
565
- timeout=timeout,
566
- metadata=metadata,
567
- )
568
- return result
569
-
570
- @GoogleBaseHook.fallback_to_default_project_id
571
- def list_datasets(
572
- self,
573
- location: str,
574
- project_id: str,
575
- retry: Retry | _MethodDefault = DEFAULT,
576
- timeout: float | None = None,
577
- metadata: Sequence[tuple[str, str]] = (),
578
- ) -> ListDatasetsPager:
579
- """
580
- List datasets in a project.
581
-
582
- :param project_id: ID of the Google Cloud project where dataset is located if None then
583
- default project_id is used.
584
- :param location: The location of the project.
585
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
586
- retried.
587
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
588
- `retry` is specified, the timeout applies to each individual attempt.
589
- :param metadata: Additional metadata that is provided to the method.
590
-
591
- :return: A `google.gax.PageIterator` instance. By default, this
592
- is an iterable of `google.cloud.automl_v1beta1.types.Dataset` instances.
593
- This object can also be configured to iterate over the pages
594
- of the response through the `options` parameter.
595
- """
596
- client = self.get_conn()
597
- parent = f"projects/{project_id}/locations/{location}"
598
- result = client.list_datasets(
599
- request={"parent": parent},
600
- retry=retry,
601
- timeout=timeout,
602
- metadata=metadata,
603
- )
604
- return result
605
-
606
- @GoogleBaseHook.fallback_to_default_project_id
607
- def delete_dataset(
608
- self,
609
- dataset_id: str,
610
- location: str,
611
- project_id: str,
612
- retry: Retry | _MethodDefault = DEFAULT,
613
- timeout: float | None = None,
614
- metadata: Sequence[tuple[str, str]] = (),
615
- ) -> Operation:
616
- """
617
- Delete a dataset and all of its contents.
618
-
619
- :param dataset_id: ID of dataset to be deleted.
620
- :param project_id: ID of the Google Cloud project where dataset is located if None then
621
- default project_id is used.
622
- :param location: The location of the project.
623
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
624
- retried.
625
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
626
- `retry` is specified, the timeout applies to each individual attempt.
627
- :param metadata: Additional metadata that is provided to the method.
628
-
629
- :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance
630
- """
631
- client = self.get_conn()
632
- name = f"projects/{project_id}/locations/{location}/datasets/{dataset_id}"
633
- result = client.delete_dataset(
634
- request={"name": name},
635
- retry=retry,
636
- timeout=timeout,
637
- metadata=metadata,
638
- )
639
- return result
640
-
641
- @GoogleBaseHook.fallback_to_default_project_id
642
- def get_dataset(
643
- self,
644
- dataset_id: str,
645
- location: str,
646
- project_id: str,
647
- retry: Retry | _MethodDefault = DEFAULT,
648
- timeout: float | None = None,
649
- metadata: Sequence[tuple[str, str]] = (),
650
- ) -> Dataset:
651
- """
652
- Retrieve the dataset for the given dataset_id.
653
-
654
- :param dataset_id: ID of dataset to be retrieved.
655
- :param location: The location of the project.
656
- :param project_id: ID of the Google Cloud project where dataset is located if None then
657
- default project_id is used.
658
- :param retry: A retry object used to retry requests. If `None` is specified, requests will not be
659
- retried.
660
- :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
661
- `retry` is specified, the timeout applies to each individual attempt.
662
- :param metadata: Additional metadata that is provided to the method.
663
-
664
- :return: `google.cloud.automl_v1beta1.types.dataset.Dataset` instance.
665
- """
666
- client = self.get_conn()
667
- name = f"projects/{project_id}/locations/{location}/datasets/{dataset_id}"
668
- return client.get_dataset(
669
- request={"name": name},
670
- retry=retry,
671
- timeout=timeout,
672
- metadata=metadata,
673
- )