apache-airflow-providers-google 16.0.0rc1__py3-none-any.whl → 16.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 (166) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +9 -5
  3. airflow/providers/google/ads/operators/ads.py +1 -1
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +1 -1
  5. airflow/providers/google/cloud/hooks/bigquery.py +2 -3
  6. airflow/providers/google/cloud/hooks/cloud_sql.py +8 -4
  7. airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
  8. airflow/providers/google/cloud/hooks/dataflow.py +2 -2
  9. airflow/providers/google/cloud/hooks/dataplex.py +1 -1
  10. airflow/providers/google/cloud/hooks/dataprep.py +4 -1
  11. airflow/providers/google/cloud/hooks/gcs.py +2 -2
  12. airflow/providers/google/cloud/hooks/looker.py +5 -1
  13. airflow/providers/google/cloud/hooks/mlengine.py +2 -1
  14. airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
  15. airflow/providers/google/cloud/hooks/spanner.py +2 -2
  16. airflow/providers/google/cloud/hooks/translate.py +1 -1
  17. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
  18. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +43 -14
  19. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
  20. airflow/providers/google/cloud/hooks/vision.py +2 -2
  21. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  22. airflow/providers/google/cloud/links/base.py +75 -11
  23. airflow/providers/google/cloud/links/bigquery.py +0 -47
  24. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  25. airflow/providers/google/cloud/links/bigtable.py +0 -48
  26. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  27. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  28. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  29. airflow/providers/google/cloud/links/cloud_run.py +1 -33
  30. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  31. airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
  32. airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
  33. airflow/providers/google/cloud/links/compute.py +0 -58
  34. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  35. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  36. airflow/providers/google/cloud/links/dataflow.py +0 -34
  37. airflow/providers/google/cloud/links/dataform.py +0 -64
  38. airflow/providers/google/cloud/links/datafusion.py +1 -96
  39. airflow/providers/google/cloud/links/dataplex.py +0 -154
  40. airflow/providers/google/cloud/links/dataprep.py +0 -24
  41. airflow/providers/google/cloud/links/dataproc.py +14 -90
  42. airflow/providers/google/cloud/links/datastore.py +0 -31
  43. airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
  44. airflow/providers/google/cloud/links/life_sciences.py +0 -19
  45. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  46. airflow/providers/google/cloud/links/mlengine.py +0 -70
  47. airflow/providers/google/cloud/links/pubsub.py +0 -32
  48. airflow/providers/google/cloud/links/spanner.py +0 -33
  49. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  50. airflow/providers/google/cloud/links/translate.py +16 -186
  51. airflow/providers/google/cloud/links/vertex_ai.py +8 -224
  52. airflow/providers/google/cloud/links/workflows.py +0 -52
  53. airflow/providers/google/cloud/operators/alloy_db.py +69 -54
  54. airflow/providers/google/cloud/operators/automl.py +16 -14
  55. airflow/providers/google/cloud/operators/bigquery.py +0 -15
  56. airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
  57. airflow/providers/google/cloud/operators/bigtable.py +35 -6
  58. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  59. airflow/providers/google/cloud/operators/cloud_build.py +74 -31
  60. airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
  61. airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
  62. airflow/providers/google/cloud/operators/cloud_run.py +0 -1
  63. airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
  64. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
  65. airflow/providers/google/cloud/operators/compute.py +7 -39
  66. airflow/providers/google/cloud/operators/datacatalog.py +156 -20
  67. airflow/providers/google/cloud/operators/dataflow.py +37 -14
  68. airflow/providers/google/cloud/operators/dataform.py +14 -4
  69. airflow/providers/google/cloud/operators/datafusion.py +4 -12
  70. airflow/providers/google/cloud/operators/dataplex.py +180 -96
  71. airflow/providers/google/cloud/operators/dataprep.py +0 -4
  72. airflow/providers/google/cloud/operators/dataproc.py +10 -16
  73. airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
  74. airflow/providers/google/cloud/operators/datastore.py +21 -5
  75. airflow/providers/google/cloud/operators/dlp.py +3 -26
  76. airflow/providers/google/cloud/operators/functions.py +15 -6
  77. airflow/providers/google/cloud/operators/gcs.py +0 -7
  78. airflow/providers/google/cloud/operators/kubernetes_engine.py +50 -7
  79. airflow/providers/google/cloud/operators/life_sciences.py +0 -1
  80. airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
  81. airflow/providers/google/cloud/operators/mlengine.py +0 -1
  82. airflow/providers/google/cloud/operators/pubsub.py +2 -4
  83. airflow/providers/google/cloud/operators/spanner.py +0 -4
  84. airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
  85. airflow/providers/google/cloud/operators/stackdriver.py +0 -8
  86. airflow/providers/google/cloud/operators/tasks.py +0 -11
  87. airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
  88. airflow/providers/google/cloud/operators/translate.py +37 -13
  89. airflow/providers/google/cloud/operators/translate_speech.py +0 -1
  90. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
  91. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
  92. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
  93. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
  94. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
  95. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
  96. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -25
  97. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
  98. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
  99. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +25 -6
  100. airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
  101. airflow/providers/google/cloud/operators/workflows.py +1 -9
  102. airflow/providers/google/cloud/sensors/bigquery.py +1 -1
  103. airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
  104. airflow/providers/google/cloud/sensors/bigtable.py +15 -3
  105. airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
  106. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
  107. airflow/providers/google/cloud/sensors/dataflow.py +3 -3
  108. airflow/providers/google/cloud/sensors/dataform.py +6 -1
  109. airflow/providers/google/cloud/sensors/datafusion.py +6 -1
  110. airflow/providers/google/cloud/sensors/dataplex.py +6 -1
  111. airflow/providers/google/cloud/sensors/dataprep.py +6 -1
  112. airflow/providers/google/cloud/sensors/dataproc.py +6 -1
  113. airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
  114. airflow/providers/google/cloud/sensors/gcs.py +9 -3
  115. airflow/providers/google/cloud/sensors/looker.py +6 -1
  116. airflow/providers/google/cloud/sensors/pubsub.py +8 -3
  117. airflow/providers/google/cloud/sensors/tasks.py +6 -1
  118. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
  119. airflow/providers/google/cloud/sensors/workflows.py +6 -1
  120. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
  121. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
  122. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +1 -2
  123. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
  124. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
  125. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
  126. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  127. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
  128. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
  129. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
  130. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  131. airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
  132. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
  133. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
  134. airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
  135. airflow/providers/google/cloud/transfers/http_to_gcs.py +1 -1
  136. airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
  137. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
  138. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
  139. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
  140. airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
  141. airflow/providers/google/cloud/utils/field_validator.py +1 -2
  142. airflow/providers/google/common/auth_backend/google_openid.py +2 -1
  143. airflow/providers/google/common/deprecated.py +2 -1
  144. airflow/providers/google/common/hooks/base_google.py +7 -3
  145. airflow/providers/google/common/links/storage.py +0 -22
  146. airflow/providers/google/firebase/operators/firestore.py +1 -1
  147. airflow/providers/google/get_provider_info.py +0 -11
  148. airflow/providers/google/leveldb/hooks/leveldb.py +5 -1
  149. airflow/providers/google/leveldb/operators/leveldb.py +1 -1
  150. airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
  151. airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
  152. airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
  153. airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
  154. airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
  155. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
  156. airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
  157. airflow/providers/google/suite/operators/sheets.py +3 -3
  158. airflow/providers/google/suite/sensors/drive.py +6 -1
  159. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
  160. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  161. airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
  162. airflow/providers/google/version_compat.py +28 -0
  163. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/METADATA +19 -20
  164. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/RECORD +166 -166
  165. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/WHEEL +0 -0
  166. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/entry_points.txt +0 -0
@@ -22,10 +22,23 @@ from __future__ import annotations
22
22
  from collections.abc import Sequence
23
23
  from typing import TYPE_CHECKING, Any
24
24
 
25
+ from google.api_core.exceptions import GoogleAPICallError
26
+ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
+ from google.cloud.aiplatform_v1beta1.types import FeatureViewDataFormat
28
+
29
+ from airflow.exceptions import AirflowException
25
30
  from airflow.providers.google.cloud.hooks.vertex_ai.feature_store import FeatureStoreHook
26
31
  from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
32
+ from airflow.providers.google.common.hooks.operation_helpers import OperationHelper
27
33
 
28
34
  if TYPE_CHECKING:
35
+ from google.api_core.retry import Retry
36
+ from google.cloud.aiplatform_v1beta1.types import (
37
+ FeatureOnlineStore,
38
+ FeatureView,
39
+ FeatureViewDataKey,
40
+ )
41
+
29
42
  from airflow.utils.context import Context
30
43
 
31
44
 
@@ -101,6 +114,257 @@ class SyncFeatureViewOperator(GoogleCloudBaseOperator):
101
114
  return response
102
115
 
103
116
 
117
+ class CreateFeatureOnlineStoreOperator(GoogleCloudBaseOperator, OperationHelper):
118
+ """
119
+ Create the Feature Online store.
120
+
121
+ This method initiates VertexAI Feature Online Store creation request.
122
+ Feature Online Store aims to serve and manage features data as a part of VertexAI MLOps.
123
+
124
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
125
+ This is used to identify which project's resources to interact with.
126
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
127
+ This specifies the Google Cloud region where the feature store resources are located.
128
+ :param feature_online_store_id: Required. The ID of the online feature store that contains
129
+ the feature view to be synchronized. This store serves as the online serving layer.
130
+ :param feature_online_store: FeatureOnlineStore configuration object of the feature online store
131
+ to be created.
132
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
133
+ Defaults to 'google_cloud_default'.
134
+ :param impersonation_chain: Optional service account to impersonate using short-term
135
+ credentials. Can be either a single account or a chain of accounts required to
136
+ get the access_token of the last account in the list, which will be impersonated
137
+ in the request. If set as a string, the account must grant the originating account
138
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
139
+ from the list must grant Service Account Token Creator IAM role to the directly
140
+ preceding identity, with first account from the list granting this role to the
141
+ originating account.
142
+ """
143
+
144
+ template_fields: Sequence[str] = (
145
+ "project_id",
146
+ "location",
147
+ "feature_online_store_id",
148
+ )
149
+
150
+ def __init__(
151
+ self,
152
+ *,
153
+ project_id: str,
154
+ location: str,
155
+ feature_online_store_id: str,
156
+ feature_online_store: FeatureOnlineStore,
157
+ timeout: float | _MethodDefault = DEFAULT,
158
+ retry: Retry | _MethodDefault | None = DEFAULT,
159
+ metadata: Sequence[tuple[str, str]] = (),
160
+ gcp_conn_id: str = "google_cloud_default",
161
+ impersonation_chain: str | Sequence[str] | None = None,
162
+ **kwargs,
163
+ ) -> None:
164
+ super().__init__(**kwargs)
165
+
166
+ self.project_id = project_id
167
+ self.location = location
168
+ self.feature_online_store_id = feature_online_store_id
169
+ self.feature_online_store = feature_online_store
170
+ self.timeout = timeout
171
+ self.retry = retry
172
+ self.metadata = metadata
173
+ self.gcp_conn_id = gcp_conn_id
174
+ self.impersonation_chain = impersonation_chain
175
+
176
+ def execute(self, context: Context) -> dict[str, Any]:
177
+ """Execute the get feature view sync operation."""
178
+ hook = FeatureStoreHook(
179
+ gcp_conn_id=self.gcp_conn_id,
180
+ impersonation_chain=self.impersonation_chain,
181
+ )
182
+ self.log.info("Creating the Feature Online Store...")
183
+ result_operation = hook.create_feature_online_store(
184
+ project_id=self.project_id,
185
+ location=self.location,
186
+ feature_online_store_id=self.feature_online_store_id,
187
+ feature_online_store=self.feature_online_store,
188
+ timeout=self.timeout,
189
+ retry=self.retry,
190
+ metadata=self.metadata,
191
+ )
192
+ op_result = self.wait_for_operation_result(operation=result_operation)
193
+ self.log.info("The Feature Online Store has been created: %s", self.feature_online_store_id)
194
+ result = type(op_result).to_dict(op_result)
195
+ return result
196
+
197
+
198
+ class GetFeatureOnlineStoreOperator(GoogleCloudBaseOperator, OperationHelper):
199
+ """
200
+ Get Feature Online store instance.
201
+
202
+ This method initiates VertexAI Feature Online Store creation request.
203
+ Feature Online Store aims to serve and manage features data as a part of VertexAI MLOps.
204
+
205
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
206
+ This is used to identify which project's resources to interact with.
207
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
208
+ This specifies the Google Cloud region where the feature store resources are located.
209
+ :param feature_online_store_id: Required. The ID of the online feature store that contains
210
+ the feature view to be synchronized. This store serves as the online serving layer.
211
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
212
+ Defaults to 'google_cloud_default'.
213
+ :param impersonation_chain: Optional service account to impersonate using short-term
214
+ credentials. Can be either a single account or a chain of accounts required to
215
+ get the access_token of the last account in the list, which will be impersonated
216
+ in the request. If set as a string, the account must grant the originating account
217
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
218
+ from the list must grant Service Account Token Creator IAM role to the directly
219
+ preceding identity, with first account from the list granting this role to the
220
+ originating account.
221
+ """
222
+
223
+ template_fields: Sequence[str] = (
224
+ "project_id",
225
+ "location",
226
+ "feature_online_store_id",
227
+ )
228
+
229
+ def __init__(
230
+ self,
231
+ *,
232
+ project_id: str,
233
+ location: str,
234
+ feature_online_store_id: str,
235
+ timeout: float | _MethodDefault = DEFAULT,
236
+ retry: Retry | _MethodDefault | None = DEFAULT,
237
+ metadata: Sequence[tuple[str, str]] = (),
238
+ gcp_conn_id: str = "google_cloud_default",
239
+ impersonation_chain: str | Sequence[str] | None = None,
240
+ **kwargs,
241
+ ) -> None:
242
+ super().__init__(**kwargs)
243
+
244
+ self.project_id = project_id
245
+ self.location = location
246
+ self.feature_online_store_id = feature_online_store_id
247
+ self.timeout = timeout
248
+ self.retry = retry
249
+ self.metadata = metadata
250
+ self.gcp_conn_id = gcp_conn_id
251
+ self.impersonation_chain = impersonation_chain
252
+
253
+ def execute(self, context: Context) -> dict[str, Any]:
254
+ """Execute the get feature view sync operation."""
255
+ hook = FeatureStoreHook(
256
+ gcp_conn_id=self.gcp_conn_id,
257
+ impersonation_chain=self.impersonation_chain,
258
+ )
259
+ self.log.info("Get the Feature Online Store id: %s...", self.feature_online_store_id)
260
+ try:
261
+ result = hook.get_feature_online_store(
262
+ project_id=self.project_id,
263
+ location=self.location,
264
+ feature_online_store_id=self.feature_online_store_id,
265
+ timeout=self.timeout,
266
+ retry=self.retry,
267
+ metadata=self.metadata,
268
+ )
269
+ except GoogleAPICallError as ex:
270
+ exc_msg = f"Google API error getting {self.feature_online_store_id} Feature Online Store instance"
271
+ raise AirflowException(exc_msg) from ex
272
+
273
+ result = type(result).to_dict(result)
274
+ self.log.info("The Feature Online Store has been retrieved: %s", self.feature_online_store_id)
275
+ return result
276
+
277
+
278
+ class CreateFeatureViewOperator(GoogleCloudBaseOperator, OperationHelper):
279
+ """
280
+ Create request for Feature View creation.
281
+
282
+ This method initiates VertexAI Feature View request for the existing Feature Online Store.
283
+ Feature View represents features and data according to the source provided.
284
+
285
+ :param feature_view_id: The ID to use for the FeatureView, which will become the final component
286
+ of the FeatureView's resource name. This value may be up to 60 characters, and valid characters
287
+ are ``[a-z0-9_]``. The first character cannot be a number.
288
+ The value must be unique within a FeatureOnlineStore.
289
+ :param feature_view: The configuration of the FeatureView to create.
290
+ :param feature_online_store_id: The ID of the online feature store.
291
+ :param run_sync_immediately: If set to true, one on demand sync will be run
292
+ immediately, regardless the FeatureView.sync_config.
293
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
294
+ This is used to identify which project's resources to interact with.
295
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
296
+ This specifies the Google Cloud region where the feature store resources are located.
297
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
298
+ Defaults to 'google_cloud_default'.
299
+ :param impersonation_chain: Optional service account to impersonate using short-term
300
+ credentials. Can be either a single account or a chain of accounts required to
301
+ get the access_token of the last account in the list, which will be impersonated
302
+ in the request. If set as a string, the account must grant the originating account
303
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
304
+ from the list must grant Service Account Token Creator IAM role to the directly
305
+ preceding identity, with first account from the list granting this role to the
306
+ originating account.
307
+ """
308
+
309
+ template_fields: Sequence[str] = (
310
+ "project_id",
311
+ "location",
312
+ "feature_online_store_id",
313
+ )
314
+
315
+ def __init__(
316
+ self,
317
+ *,
318
+ feature_view_id: str,
319
+ feature_view: FeatureView,
320
+ feature_online_store_id: str,
321
+ run_sync_immediately: bool = False,
322
+ project_id: str,
323
+ location: str,
324
+ timeout: float | _MethodDefault = DEFAULT,
325
+ retry: Retry | _MethodDefault | None = DEFAULT,
326
+ metadata: Sequence[tuple[str, str]] = (),
327
+ gcp_conn_id: str = "google_cloud_default",
328
+ impersonation_chain: str | Sequence[str] | None = None,
329
+ **kwargs,
330
+ ) -> None:
331
+ super().__init__(**kwargs)
332
+ self.project_id = project_id
333
+ self.location = location
334
+ self.feature_view_id = feature_view_id
335
+ self.feature_view = feature_view
336
+ self.run_sync_immediately = run_sync_immediately
337
+ self.feature_online_store_id = feature_online_store_id
338
+ self.timeout = timeout
339
+ self.retry = retry
340
+ self.metadata = metadata
341
+ self.gcp_conn_id = gcp_conn_id
342
+ self.impersonation_chain = impersonation_chain
343
+
344
+ def execute(self, context: Context) -> dict[str, Any]:
345
+ """Execute the get feature view sync operation."""
346
+ hook = FeatureStoreHook(
347
+ gcp_conn_id=self.gcp_conn_id,
348
+ impersonation_chain=self.impersonation_chain,
349
+ )
350
+ self.log.info("Creating the Online Store Feature View...")
351
+ result_operation = hook.create_feature_view(
352
+ project_id=self.project_id,
353
+ location=self.location,
354
+ feature_view_id=self.feature_view_id,
355
+ feature_view=self.feature_view,
356
+ feature_online_store_id=self.feature_online_store_id,
357
+ run_sync_immediately=self.run_sync_immediately,
358
+ timeout=self.timeout,
359
+ retry=self.retry,
360
+ metadata=self.metadata,
361
+ )
362
+ op_result = self.wait_for_operation_result(operation=result_operation)
363
+ self.log.info("The Online Store Feature View has been created: %s", self.feature_online_store_id)
364
+ result = type(op_result).to_dict(op_result)
365
+ return result
366
+
367
+
104
368
  class GetFeatureViewSyncOperator(GoogleCloudBaseOperator):
105
369
  """
106
370
  Retrieve the status and details of a Feature View synchronization operation.
@@ -161,3 +425,270 @@ class GetFeatureViewSyncOperator(GoogleCloudBaseOperator):
161
425
  self.log.info(response)
162
426
 
163
427
  return response
428
+
429
+
430
+ class FetchFeatureValuesOperator(GoogleCloudBaseOperator, OperationHelper):
431
+ """
432
+ Fetch features data from the Feature View provided.
433
+
434
+ This method fetches data from existing Feature view, filtered by provided (or default) data_key.
435
+ Helps to retrieve actual features data hosted in the VertexAI Feature Store.
436
+
437
+ :param entity_id: Simple ID to identify Entity to fetch feature values for.
438
+ :param feature_view_id: The FeatureView ID to fetch data from.
439
+ :param feature_online_store_id: The ID of the online feature store.
440
+ :param data_key: The request key to fetch feature values for.
441
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
442
+ This is used to identify which project's resources to interact with.
443
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
444
+ This specifies the Google Cloud region where the feature store resources are located.
445
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
446
+ Defaults to 'google_cloud_default'.
447
+ :param impersonation_chain: Optional service account to impersonate using short-term
448
+ credentials. Can be either a single account or a chain of accounts required to
449
+ get the access_token of the last account in the list, which will be impersonated
450
+ in the request. If set as a string, the account must grant the originating account
451
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
452
+ from the list must grant Service Account Token Creator IAM role to the directly
453
+ preceding identity, with first account from the list granting this role to the
454
+ originating account.
455
+ """
456
+
457
+ template_fields: Sequence[str] = (
458
+ "project_id",
459
+ "location",
460
+ "feature_online_store_id",
461
+ "feature_view_id",
462
+ "entity_id",
463
+ )
464
+
465
+ def __init__(
466
+ self,
467
+ *,
468
+ feature_view_id: str,
469
+ feature_online_store_id: str,
470
+ project_id: str,
471
+ location: str,
472
+ entity_id: str | None = None,
473
+ data_key: FeatureViewDataKey | None = None,
474
+ timeout: float | _MethodDefault = DEFAULT,
475
+ retry: Retry | _MethodDefault | None = DEFAULT,
476
+ metadata: Sequence[tuple[str, str]] = (),
477
+ gcp_conn_id: str = "google_cloud_default",
478
+ impersonation_chain: str | Sequence[str] | None = None,
479
+ **kwargs,
480
+ ) -> None:
481
+ super().__init__(**kwargs)
482
+ self.project_id = project_id
483
+ self.location = location
484
+ self.entity_id = entity_id
485
+ self.feature_view_id = feature_view_id
486
+ self.feature_online_store_id = feature_online_store_id
487
+ self.data_key = data_key
488
+ self.timeout = timeout
489
+ self.retry = retry
490
+ self.metadata = metadata
491
+ self.gcp_conn_id = gcp_conn_id
492
+ self.impersonation_chain = impersonation_chain
493
+
494
+ def execute(self, context: Context) -> dict[str, Any]:
495
+ """Execute the get feature view sync operation."""
496
+ hook = FeatureStoreHook(
497
+ gcp_conn_id=self.gcp_conn_id,
498
+ impersonation_chain=self.impersonation_chain,
499
+ )
500
+ try:
501
+ feature_online_store = hook.get_feature_online_store(
502
+ feature_online_store_id=self.feature_online_store_id,
503
+ project_id=self.project_id,
504
+ location=self.location,
505
+ )
506
+ public_domain_name = hook._get_featurestore_public_endpoint(feature_online_store)
507
+ except GoogleAPICallError as ex:
508
+ exc_msg = f"Google API error getting {self.feature_online_store_id} Feature Online Store instance"
509
+ raise AirflowException(exc_msg) from ex
510
+
511
+ self.log.info(
512
+ "Fetching data from the Feature View %s, Online Feature Store %s.",
513
+ self.feature_view_id,
514
+ self.feature_online_store_id,
515
+ )
516
+ request_result = hook.fetch_feature_values(
517
+ project_id=self.project_id,
518
+ location=self.location,
519
+ endpoint_domain_name=public_domain_name,
520
+ entity_id=self.entity_id,
521
+ feature_view_id=self.feature_view_id,
522
+ feature_online_store_id=self.feature_online_store_id,
523
+ data_key=self.data_key,
524
+ data_format=FeatureViewDataFormat.KEY_VALUE,
525
+ timeout=self.timeout,
526
+ retry=self.retry,
527
+ metadata=self.metadata,
528
+ )
529
+ self.log.info(
530
+ "Fetching data from the Feature View %s, Online Feature Store %s. is finished.",
531
+ self.feature_view_id,
532
+ self.feature_online_store_id,
533
+ )
534
+ result = type(request_result).to_dict(request_result)
535
+ return result
536
+
537
+
538
+ class DeleteFeatureOnlineStoreOperator(GoogleCloudBaseOperator, OperationHelper):
539
+ """
540
+ Delete the Feature Online store.
541
+
542
+ This method initiates VertexAI Feature Online Store deletion request.
543
+ There should be no FeatureViews to be deleted successfully.
544
+
545
+
546
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
547
+ This is used to identify which project's resources to interact with.
548
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
549
+ This specifies the Google Cloud region where the feature store resources are located.
550
+ :param feature_online_store_id: Required. The ID of the online feature store that contains
551
+ the feature view to be synchronized. This store serves as the online serving layer.
552
+ :param force: If set to true, any FeatureViews and Features for this FeatureOnlineStore
553
+ will also be deleted.
554
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
555
+ Defaults to 'google_cloud_default'.
556
+ :param impersonation_chain: Optional service account to impersonate using short-term
557
+ credentials. Can be either a single account or a chain of accounts required to
558
+ get the access_token of the last account in the list, which will be impersonated
559
+ in the request. If set as a string, the account must grant the originating account
560
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
561
+ from the list must grant Service Account Token Creator IAM role to the directly
562
+ preceding identity, with first account from the list granting this role to the
563
+ originating account.
564
+ """
565
+
566
+ template_fields: Sequence[str] = (
567
+ "project_id",
568
+ "location",
569
+ "feature_online_store_id",
570
+ )
571
+
572
+ def __init__(
573
+ self,
574
+ *,
575
+ project_id: str,
576
+ location: str,
577
+ feature_online_store_id: str,
578
+ force: bool = False,
579
+ timeout: float | _MethodDefault = DEFAULT,
580
+ retry: Retry | _MethodDefault | None = DEFAULT,
581
+ metadata: Sequence[tuple[str, str]] = (),
582
+ gcp_conn_id: str = "google_cloud_default",
583
+ impersonation_chain: str | Sequence[str] | None = None,
584
+ **kwargs,
585
+ ) -> None:
586
+ super().__init__(**kwargs)
587
+ self.project_id = project_id
588
+ self.location = location
589
+ self.feature_online_store_id = feature_online_store_id
590
+ self.force = force
591
+ self.timeout = timeout
592
+ self.retry = retry
593
+ self.metadata = metadata
594
+ self.gcp_conn_id = gcp_conn_id
595
+ self.impersonation_chain = impersonation_chain
596
+
597
+ def execute(self, context: Context) -> dict[str, Any]:
598
+ """Execute the get feature view sync operation."""
599
+ hook = FeatureStoreHook(
600
+ gcp_conn_id=self.gcp_conn_id,
601
+ impersonation_chain=self.impersonation_chain,
602
+ )
603
+ self.log.info("Deleting the Feature Online Store...")
604
+
605
+ result_operation = hook.delete_feature_online_store(
606
+ project_id=self.project_id,
607
+ location=self.location,
608
+ feature_online_store_id=self.feature_online_store_id,
609
+ force=self.force,
610
+ timeout=self.timeout,
611
+ retry=self.retry,
612
+ metadata=self.metadata,
613
+ )
614
+ self.wait_for_operation_result(operation=result_operation)
615
+ self.log.info("The Feature Online Store deletion has been complete: %s", self.feature_online_store_id)
616
+
617
+ return {"result": f"The {self.feature_online_store_id} has been deleted."}
618
+
619
+
620
+ class DeleteFeatureViewOperator(GoogleCloudBaseOperator, OperationHelper):
621
+ """
622
+ Delete the Feature View.
623
+
624
+ This method deletes the Feature View from the Feature Online Store.
625
+
626
+ :param project_id: Required. The ID of the Google Cloud project that contains the feature store.
627
+ This is used to identify which project's resources to interact with.
628
+ :param location: Required. The location of the feature store (e.g., 'us-central1', 'us-east1').
629
+ This specifies the Google Cloud region where the feature store resources are located.
630
+ :param feature_online_store_id: Required. The ID of the online feature store that contains
631
+ the feature view to be synchronized. This store serves as the online serving layer.
632
+ :param gcp_conn_id: The connection ID to use for connecting to Google Cloud Platform.
633
+ Defaults to 'google_cloud_default'.
634
+ :param impersonation_chain: Optional service account to impersonate using short-term
635
+ credentials. Can be either a single account or a chain of accounts required to
636
+ get the access_token of the last account in the list, which will be impersonated
637
+ in the request. If set as a string, the account must grant the originating account
638
+ the Service Account Token Creator IAM role. If set as a sequence, the identities
639
+ from the list must grant Service Account Token Creator IAM role to the directly
640
+ preceding identity, with first account from the list granting this role to the
641
+ originating account.
642
+ """
643
+
644
+ template_fields: Sequence[str] = (
645
+ "project_id",
646
+ "location",
647
+ "feature_online_store_id",
648
+ )
649
+
650
+ def __init__(
651
+ self,
652
+ *,
653
+ project_id: str,
654
+ location: str,
655
+ feature_online_store_id: str,
656
+ feature_view_id: str,
657
+ timeout: float | _MethodDefault = DEFAULT,
658
+ retry: Retry | _MethodDefault | None = DEFAULT,
659
+ metadata: Sequence[tuple[str, str]] = (),
660
+ gcp_conn_id: str = "google_cloud_default",
661
+ impersonation_chain: str | Sequence[str] | None = None,
662
+ **kwargs,
663
+ ) -> None:
664
+ super().__init__(**kwargs)
665
+ self.project_id = project_id
666
+ self.location = location
667
+ self.feature_online_store_id = feature_online_store_id
668
+ self.feature_view_id = feature_view_id
669
+ self.timeout = timeout
670
+ self.retry = retry
671
+ self.metadata = metadata
672
+ self.gcp_conn_id = gcp_conn_id
673
+ self.impersonation_chain = impersonation_chain
674
+
675
+ def execute(self, context: Context) -> dict[str, Any]:
676
+ """Execute the get feature view sync operation."""
677
+ hook = FeatureStoreHook(
678
+ gcp_conn_id=self.gcp_conn_id,
679
+ impersonation_chain=self.impersonation_chain,
680
+ )
681
+ self.log.info("Deleting the Feature View %s ... ", self.feature_view_id)
682
+ result_operation = hook.delete_feature_view(
683
+ project_id=self.project_id,
684
+ location=self.location,
685
+ feature_online_store_id=self.feature_online_store_id,
686
+ feature_view_id=self.feature_view_id,
687
+ timeout=self.timeout,
688
+ retry=self.retry,
689
+ metadata=self.metadata,
690
+ )
691
+ self.wait_for_operation_result(operation=result_operation)
692
+ self.log.info("The Feature View deletion has been complete: %s", self.feature_view_id)
693
+
694
+ return {"result": f"The {self.feature_view_id} has been deleted."}