Exemplo n.º 1
0
    def _eval(self, segment, dialect, **kwargs):
        if segment.is_type("statement"):
            queries = SelectCrawler.gather(segment, dialect)

            # Begin analysis at the final, outer query (key=None).
            self._visit_sources(queries.pop(None), dialect, queries)
            if queries:
                return LintResult(anchor=segment)
        return None
Exemplo n.º 2
0
    def _eval(self, segment, dialect, **kwargs):
        """Outermost query should produce known number of columns."""
        if segment.is_type("statement"):
            queries = SelectCrawler.gather(segment, dialect)

            # Begin analysis at the final, outer query (key=None).
            select_info = queries[None]
            try:
                return self._analyze_result_columns(select_info, dialect, queries)
            except RuleFailure:
                return LintResult(anchor=queries[None][0].select_info.select_statement)
        return None