gitbase 是mysql server 的一个实现(主要是用来分析git仓库代码),但是里面好多功能可能并不是很强大(sql 的限制)
我们可以通过singer 的tap-mysql
将数据抽取到标准的pg 数据库,可以方便的使用pg 的好多函数
mysql-postgresql 的可以参考 https://www.cnblogs.com/rongfengliang/p/10239118.html
具体的转换很简单,主要是说明几个gitbase 上的缺陷以及怎么解决
实际的代码可以参考https://github.com/rongfengliang/gitbase2postgresql
属于临时解决了,修改singer 关于string 类型处理
elif data_type in STRING_TYPES:
result.type = [‘null‘, ‘string‘] result.type = [‘null‘, ‘string‘]
result.maxLength = c.character_maximum_length result.maxLength = 255
git clone https://github.com/rongfengliang/tap-mysql.git
pip install -e tap-mysql
因为singer 推荐的方式是venv 安装,所以tap 以及target 最好是使用venv 解决,不然会有各种问题(singer 是基于pipe 的处理模型)
https://github.com/rongfengliang/tap-mysql
https://github.com/rongfengliang/tap-mysql
https://github.com/rongfengliang/gitbase2postgresql
使用singer 转换gitbase 数据到postgresql
原文:https://www.cnblogs.com/rongfengliang/p/10889867.html