コード例 #1
0
 def execute(self, context):
     hook = CloudSQLHook(gcp_conn_id=self.gcp_conn_id,
                         api_version=self.api_version)
     if not self._check_if_instance_exists(self.instance, hook):
         raise AirflowException(
             'Cloud SQL instance with ID {} does not exist. '
             'Please specify another instance to patch.'.format(
                 self.instance))
     else:
         return hook.patch_instance(project_id=self.project_id,
                                    body=self.body,
                                    instance=self.instance)
コード例 #2
0
ファイル: cloud_sql.py プロジェクト: pingzh/airflow
 def execute(self, context: 'Context'):
     hook = CloudSQLHook(
         gcp_conn_id=self.gcp_conn_id,
         api_version=self.api_version,
         impersonation_chain=self.impersonation_chain,
     )
     if not self._check_if_instance_exists(self.instance, hook):
         raise AirflowException(
             f'Cloud SQL instance with ID {self.instance} does not exist. '
             'Please specify another instance to patch.'
         )
     else:
         return hook.patch_instance(project_id=self.project_id, body=self.body, instance=self.instance)