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