def analyze(self, stmt: Statement) -> LineageResult: if stmt.get_type() == "DROP": self._extract_from_DDL_DROP(stmt) elif stmt.get_type() == "ALTER": self._extract_from_DDL_ALTER(stmt) elif (stmt.get_type() == "DELETE" or stmt.token_first(skip_cm=True).normalized == "TRUNCATE" or stmt.token_first(skip_cm=True).normalized.upper() == "REFRESH" or stmt.token_first(skip_cm=True).normalized == "CACHE"): pass else: # DML parsing logic also applies to CREATE DDL self._extract_from_DML(stmt) return self._lineage_result
def analyze(self, stmt: Statement) -> LineageResult: """ to analyze the Statement and store the result into :class:`LineageResult`. :param stmt: a SQL statement parsed by `sqlparse` """ if stmt.get_type() == "DROP": self._extract_from_ddl_drop(stmt) elif stmt.get_type() == "ALTER": self._extract_from_ddl_alter(stmt) elif (stmt.get_type() == "DELETE" or stmt.token_first(skip_cm=True).normalized == "TRUNCATE" or stmt.token_first(skip_cm=True).normalized.upper() == "REFRESH" or stmt.token_first(skip_cm=True).normalized == "CACHE"): pass else: # DML parsing logic also applies to CREATE DDL self._extract_from_dml(stmt) return self._lineage_result