synth 简单试用

以下是一个简单的试用,主要是体验下synth 的功能

安装

我使用的mac 系统,其他系统按照官方文档操作

curl --proto '=https' --tlsv1.2 -sSL https://getsynth.com/install | sh

项目创建

  • 创建文件夹
mkdir  first
  • 创建简单模型
    我直接通过pg 数据库导入的
 
synth import --from postgres://user:pass@localhost:5432/postgres --schema public sensor

效果

  • 准备数据库
    docker-compose 文件,基于pg 的测试
 
version: "3"
services:
   postgres:
      image: postgres:16.0
      ports:
        - "5432:5432"
      environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=postgres
  • 生成
synth generate --size 100 --to postgres://postgres:postgres@localhost:5432 --schema public sensor

说明

目前直接基于db生成db数据的时候是有一些问题,并不是很顺畅,毕竟我们实际业务中还是比较复杂的,为了更好的生成数据还是还得更好的调整模型
让模型更加符合实际业务,synth 工具值得学习下

参考资料

https://github.com/shuttle-hq/synth
https://github.com/shuttle-hq/synth/tree/master/examples/bank/bank_db
https://www.getsynth.com/docs/getting_started/hello-world

posted on 2024-01-16 11:53  荣锋亮  阅读(5)  评论(0编辑  收藏  举报

导航