dolt 基于git协议的数据管理工具

dolt 基于git 协议提供了多版本,分支特性的数据管理工具,使用简单,同时也提供了类似github 的一个云服务

安装

使用

  • init
dolt init

参考提示添加配置

Could not determine user.name. Use the init parameter --name "FIRST LAST" to set it for this repo, or dolt config --global --add user.name "FIRST LAST"
usage: dolt init [<options>] [<path>]
Specific dolt init options
    --name=<name>
      The name used in commits to this repo. If not provided will be taken
      from "user.name" in the global config.
    --email=<email>
      The email address used. If not provided will be taken from
      "user.email" in the global config.
 
 
dolt config --global --add user.name "dalong"
dolt config --global --add user.email "1141591465@qq.com"

重新运行效果

dolt init                                    
Successfully initialized dolt data repository.

目录结构

tree .dolt 
.dolt
├── config.json
├── noms
├── 4bujnjuatdli0klda7ucot0tl836jujt
├── LOCK
├── imfkg6k82o3lajgqh297rf1keldounr7
├── manifest
├── obi3h4k8ci1l3rdqq746ncs893dgptfl
└── u1jpqa68sgephuj7q2r0bdie06ctdm20
└── repo_state.json
1 directory, 8 files
 
 
  • 添加sql支持
dolt sql -q "create table state_populations ( state varchar, population int, primary key (state) )"
dolt sql -q "show tables"

效果

+-------------------+
| tables |
+-------------------+
| state_populations |
+-------------------+
 
 
  • 插入数据
dolt sql -q 'insert into state_populations (state, population) values
("Delaware", 59096),
("Maryland", 319728),
("Tennessee", 35691),
("Virginia", 691937),
("Connecticut", 237946),
("Massachusetts", 378787),
("South Carolina", 249073),
("New Hampshire", 141885),
("Vermont", 85425),
("Georgia", 82548),
("Pennsylvania", 434373),
("Kentucky", 73677),
("New York", 340120),
("New Jersey", 184139),
("North Carolina", 393751),
("Maine", 96540),
("Rhode Island", 68825)'
 
 
  • 查询
dolt sql -q "select * from state_populations where state = 'New York'"

效果


+----------+------------+
| state | population |
+----------+------------+
| New York | 340120 |
+----------+------------+
 
 
  • git 方式 提交操作
first dolt add .
first dolt commit -m "init demo"
commit 1j1o30pvevn6ldbpg2jeu43i7uu6b3pj
Author: dalong <1141591465@qq.com>
Date: Sun Oct 27 11:06:57 +0800 2019
 init demo
first dolt status
On branch master
nothing to commit, working tree clean

说明

以上是一个简单的操作,实际上dolt 支持了方便的数据导入,数据更新功能,功能操作和git 一直,源码基于golang 编写,可以学习下源码

参考资料

https://github.com/liquidata-inc/dolt

posted on   荣锋亮  阅读(1885)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-10-27 hasura graphql-engine v1.0.0-alpha26 版本新功能试用
2018-10-27 hasura graphql-engine v1.0.0-alpha26 版本新功能

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示