def _get_workbook_by_name(self, tableau_hook: TableauHook) -> WorkbookItem:
        for workbook in tableau_hook.get_all(resource_name='workbooks'):
            if workbook.name == self.workbook_name:
                self.log.info('Found matching workbook with id %s', workbook.id)
                return workbook

        raise AirflowException(f'Workbook {self.workbook_name} not found!')
예제 #2
0
    def _get_resource_id(self, tableau_hook: TableauHook) -> str:

        if self.match_with == 'id':
            return self.find

        for resource in tableau_hook.get_all(resource_name=self.resource):
            if getattr(resource, self.match_with) == self.find:
                resource_id = resource.id
                self.log.info('Found matching with id %s', resource_id)
                return resource_id

        raise AirflowException(f'{self.resource} with {self.match_with} {self.find} not found!')