def _analyze_result_columns(self, query: Query):
    'Given info on a list of SELECTs, determine whether to warn.'
    if (not query.selectables):
        return
    for selectable in query.selectables:
        self.logger.debug(f'Analyzing query: {selectable.selectable.raw}')
        for wildcard in selectable.get_wildcard_info():
            if wildcard.tables:
                for wildcard_table in wildcard.tables:
                    self.logger.debug(f'Wildcard: {wildcard.segment.raw} has target {{wildcard_table}}')
                    alias_info = selectable.find_alias(wildcard_table)
                    if alias_info:
                        self._handle_alias(selectable, alias_info, query)
                    else:
                        cte = query.lookup_cte(wildcard_table)
                        if cte:
                            self._analyze_result_columns(cte)
                        else:
                            self.logger.debug(f'Query target {wildcard_table} is external. Generating warning.')
                            raise RuleFailure(selectable.selectable)
            else:
                query_list = SelectCrawler.get(query, query.selectables[0].selectable)
                for o in query_list:
                    if isinstance(o, Query):
                        self._analyze_result_columns(o)
                        return
                self.logger.debug(f'Query target "{query.selectables[0].selectable.raw}" has no targets. Generating warning.')
                raise RuleFailure(query.selectables[0].selectable)
Given info on a list of SELECTs, determine whether to warn.
def _analyze_result_columns(self, query: Query):
    
    if (not query.selectables):
        return
    for selectable in query.selectables:
        self.logger.debug(f'Analyzing query: {selectable.selectable.raw}')
        for wildcard in selectable.get_wildcard_info():
            if wildcard.tables:
                for wildcard_table in wildcard.tables:
                    self.logger.debug(f'Wildcard: {wildcard.segment.raw} has target {{wildcard_table}}')
                    alias_info = selectable.find_alias(wildcard_table)
                    if alias_info:
                        self._handle_alias(selectable, alias_info, query)
                    else:
                        cte = query.lookup_cte(wildcard_table)
                        if cte:
                            self._analyze_result_columns(cte)
                        else:
                            self.logger.debug(f'Query target {wildcard_table} is external. Generating warning.')
                            raise RuleFailure(selectable.selectable)
            else:
                query_list = SelectCrawler.get(query, query.selectables[0].selectable)
                for o in query_list:
                    if isinstance(o, Query):
                        self._analyze_result_columns(o)
                        return
                self.logger.debug(f'Query target "{query.selectables[0].selectable.raw}" has no targets. Generating warning.')
                raise RuleFailure(query.selectables[0].selectable)