Source code for airflow.providers.google.cloud.hooks.datapipeline
## Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing,# software distributed under the License is distributed on an# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY# KIND, either express or implied. See the License for the# specific language governing permissions and limitations# under the License."""This module contains a Google Data Pipelines Hook."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfromdeprecatedimportdeprecatedfromairflow.exceptionsimportAirflowProviderDeprecationWarningfromairflow.providers.google.cloud.hooks.dataflowimportDataflowHookfromairflow.providers.google.common.hooks.base_googleimportGoogleBaseHookifTYPE_CHECKING:fromgoogleapiclient.discoveryimportbuild
@deprecated(reason="This hook is deprecated and will be removed after 01.12.2024. Please use `DataflowHook`.",category=AirflowProviderDeprecationWarning,)
[docs]classDataPipelineHook(DataflowHook):"""Hook for Google Data Pipelines."""
[docs]defget_conn(self)->build:"""Return a Google Cloud Data Pipelines service object."""returnsuper().get_pipelines_conn()
@GoogleBaseHook.fallback_to_default_project_id
[docs]defcreate_data_pipeline(self,body:dict,project_id:str,location:str=DEFAULT_DATAPIPELINE_LOCATION,)->dict:"""Create a new Data Pipelines instance from the Data Pipelines API."""returnsuper().create_data_pipeline(body=body,project_id=project_id,location=location)
@GoogleBaseHook.fallback_to_default_project_id
[docs]defrun_data_pipeline(self,data_pipeline_name:str,project_id:str,location:str=DEFAULT_DATAPIPELINE_LOCATION,)->dict:"""Run a Data Pipelines Instance using the Data Pipelines API."""returnsuper().run_data_pipeline(pipeline_name=data_pipeline_name,project_id=project_id,location=location)