sql parser

最近在整理很多SQL代码, 需要分析出每个SQL的目标表和源表各有哪些, 网上没有找到工作具, 打算写个工具.

Java调研结果:
1. 商业组件包 sqlparser 有试用版组件, 限制SQL少于10000字符,99天后过期
2. 使用 presto 的 parser 或 druid 的 parser. 
3. 使用 JSqlParser
时间紧任务重, 暂时先用商业组件包 sqlparser 试用版组件完成手头任务. 有空考虑 presto 和 JSqlParser 做一个工具.

Python 调研结果: https://github.com/andialbrecht/sqlparse 更好一些. 


下面网上找到的资源:

有没有好用的开源sql语法分析器?
https://www.zhihu.com/question/51676071
讨论中有推荐 presto

利用 druid 的 sql parser 模块解析 sql 语句
http://www.cnblogs.com/etangyushan/p/5490183.html


JSqlParser
https://github.com/JSQLParser/JSqlParser
http://www.cnblogs.com/liuwt0911/p/4420472.html


python  
https://github.com/andialbrecht/sqlparse
https://pypi.org/project/PySQLParser/

商业组件包 sqlparser, 支持VCL/.Net/Java, 有试用版(限制SQL少于10000字符,99天后过期)
http://www.sqlparser.com/download.php

商业组件包 sqlparser的 python-bind(用C写的, 编译麻烦些)
https://github.com/TwoLaid/python-sqlparser


FoundationDB 的 sql-parser(FoundationDB已经转为闭源项目)
http://blog.csdn.net/isea533/article/details/38361911

原文地址:https://www.cnblogs.com/harrychinese/p/sql_parser.html