Coder Social home page Coder Social logo

durineage's Introduction

durineage

描述

解析SQL语句,分析血缘。不是table-table的关系,是column-column关系。

使用

只有一个功能

Lineage lineage = new Lineage();
DB db = lineage.getInfo(sql语句, 数据库类型);	//sql语句可为String、String[]、List<String>

规范(局限)

全局

  • 绝对不要用“*”
  • 如果字段不参与血缘,尽量不要被“count”,尽量用“count(1)”
  • 所有字段格式:别名.字段名

select

  • 绝对不要嵌“子查询”

from

  • 所有表格式:schema.表名 [as] 别名
    • 所有表都得有“别名”
    • 有schema的一定要加schema
  • 子查询即使是内外嵌套,别名最好也不要相同
  • 关联查询一定要用“join”,不能用其他

create

  • create table schema.表名 as select …
    • as必须得加

insert

  • insert into schema.表名 (字段名[,…]) select …
    • select前的字段必须得加

  • 默认drop语句表示该表是临时表,最终血缘中不予以展示
  • 本工具解析sql的读取功能使用druid实现,所以解析血缘的前提是sql能被druid读取,druid读取出错,就别提下一步解析了。
  • 事实上create规范中as必须加中也是druid的要求。
  • 实际上druid还不支持“nolock”、“if exists”,只是本工具已经在druid读取之前已经将这两个过滤掉了。目前还有哪些不支持还未知。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.