schemacrawler 免费开源的数据库schema 发现以及理解工具
schemacrawler 是基于java 开发的免费开源的数据库schema 发现以及理解工具
schemacrawler 包含的几个周边
- cli
提供了cli 我们可以方便的处理不同数据库的处理,同时支持输出为html,json,yaml - java api
通过java api 可以方便的通过pojo 获取数据库元数据信息
目前提供的数据库元数据对象
- 列类型
- 表视图
- 列
- 主键
- 索引
- 表约束
- 触发器
- 外健
- 函数以及存储过程信息
- 序列
- 同义词
- 权限以及准予
参考java 集成
- 参考代码
final SchemaCrawlerOptions options = SchemaCrawlerOptionsBuilder.builder().toOptions();
final Catalog catalog = SchemaCrawlerUtility.getCatalog(getConnection(), options);
for (final Schema schema : catalog.getSchemas())
{
System.out.println(schema);
for (final Table table : catalog.getTables(schema))
{
System.out.print("o--> " + table);
for (final Column column : table.getColumns())
{
System.out.println(
" o--> " + column + " (" + column.getColumnDataType() + ")");
}
}
}
说明
如果大概看下github 会发现目前schemacrawler 也支持chatgpt 了,也是一个很不错的功能点,值得看看,数据集成ai 的玩法基本已经成为了一个标配了
参考资料
https://www.schemacrawler.com/
https://github.com/schemacrawler/SchemaCrawler
https://killercoda.com/schemacrawler