A Tool to Visualize Definition of Tables in RDB

Link:
https://github.com/maru44/scheman

Scheman is a tool to visualize definition of tables in RDB.

Main purpose of this is accelerating working collaboration between engineers and non-engineers.

You can generate drawing of tables schema and ERD wit…


This content originally appeared on DEV Community and was authored by DEV Community

Link:
https://github.com/maru44/scheman

Scheman is a tool to visualize definition of tables in RDB.

Main purpose of this is accelerating working collaboration between engineers and non-engineers.

You can generate drawing of tables schema and ERD with one command and just a few settings by using this.

You can choose output destination from Notion, File or both of them.

Usage

I will show you usage.

Installation

install

go install github.com/maru44/scheman@v1.3.0

If you want not to install you can use by

go run github.com/maru44/scheman@v1.3.0 ...

I will proceed on the premise of scheman installed.

Setup config

Create scheman.toml(.yaml) and write database settings.

[psql]
  dbname  = "scheman"
  host    = "localhost"
  port    = 5432
  user    = "root"
  pass    = "password"
  sslmode = "disable"
  schema  = "public"

Command

I will show some examples.

Notion

First I will show you the command to write tables schema and ERD in notion.

go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@v4.8.6 \
  && scheman psql --services notion --erd-outputs notion \
    --notion-token ${NOTION_TOKEN} --notion-page-id ${PSQL_NOTION_PAGE_ID}

Flag services indicates the output destinations of schema-definition.
Flag erd-outputs indicates the output destinations of ERD.

The value of table-index is output like the following picture if the command succeeded.
If you want to overwrite schema definition and ERD in notion from next time, please set notion-page-index the value outputted in command line.

result outputted in command line

The Free Entry attribute is the attribute you can write freely. This value is inherited even if you execute scheman command next time.

The outputs will be like these pictures.
I'm sorry for these pictures are very rough.

schema-definition
https://user-images.githubusercontent.com/46714011/155822065-f0f9f785-b2b1-4abd-b98b-052496dff169.png

ERD
https://user-images.githubusercontent.com/46714011/155862202-77e81b99-681a-44fb-bf1c-669dae7f1f5a.png

File

go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@v4.8.6 \
  && scheman psql --def-file ./def.csv --erd-file ./erd.md

Flag def-file indicates the output destination file of schema-definition.
Flag erd-file indicates the output destination file of ERD.

The outputs will be like these.

schema-definition
https://github.com/maru44/scheman/blob/master/testdata/postgres/def.csv

ERD
https://github.com/maru44/scheman/blob/master/testdata/postgres/erd.md

Options

  • config
    • the file written configurations
    • default is scheman
    • you can use sqlboiler.toml if you set this sqlboiler.toml
  • services
    • indicates the output destinations of schema-definition
    • default is [ ]
    • option is only notion yet
  • erd-outputs
    • indicates the output destinations of ERD
    • default is [ ]
    • option is only notion yet
  • disable-views
    • if true, scheman ignore views
    • default is false
  • attr-ignore
    • which attributes ignore
    • default is [ ]
    • options are Data Type, PK, Auto Generate, Unique, Null, Default, Comment, Free Entry, Enum

Thanks

Using sqlboiler to parse connected database.
https://github.com/volatiletech/sqlboiler

Using go-notion as notion client.
https://github.com/dstotijn/go-notion


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-03-05T00:09:52+00:00) A Tool to Visualize Definition of Tables in RDB. Retrieved from https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/

MLA
" » A Tool to Visualize Definition of Tables in RDB." DEV Community | Sciencx - Saturday March 5, 2022, https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/
HARVARD
DEV Community | Sciencx Saturday March 5, 2022 » A Tool to Visualize Definition of Tables in RDB., viewed ,<https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/>
VANCOUVER
DEV Community | Sciencx - » A Tool to Visualize Definition of Tables in RDB. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/
CHICAGO
" » A Tool to Visualize Definition of Tables in RDB." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/
IEEE
" » A Tool to Visualize Definition of Tables in RDB." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/. [Accessed: ]
rf:citation
» A Tool to Visualize Definition of Tables in RDB | DEV Community | Sciencx | https://www.scien.cx/2022/03/05/a-tool-to-visualize-definition-of-tables-in-rdb/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.