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)
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)