#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/4/9 9:18 # @Author : old tom # @File : relation_analyze.py # @Project : futool-tiny-datahub # @Desc : from sqllineage.runner import LineageRunner class MetadataRelationAnalyzer(object): """ 元数据关系分析 流程:从元数据存储读取视图-->分析视图(递归)-->视图与表关联关系-->存入Neo4j """ def __init__(self, source_id): self.source_id = source_id if __name__ == '__main__': with open(r'D:\文档\工作\ATD\2023上半年\项目\事权\DW_FINANCE_PLAN_DETAIL_BASE_VW.sql', 'r', encoding='utf-8') as f: sql = f.read() runner = LineageRunner(sql, dialect='oracle') # 画图 # runner.draw(dialect='oracle') print(runner) print(runner.source_tables)