All Projects → akarki15 → Dbdot

akarki15 / Dbdot

Licence: mit
Generate DOT description for postgres db schema

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Dbdot

Squid
🦑 Provides SQL tagged template strings and schema definition functions.
Stars: ✭ 57 (-85.96%)
Mutual labels:  schema, postgresql
Eralchemy
Entity Relation Diagrams generation tool
Stars: ✭ 767 (+88.92%)
Mutual labels:  schema, postgresql
E Commerce Db
Database schema for e-commerce (webstores) sites.
Stars: ✭ 245 (-39.66%)
Mutual labels:  schema, postgresql
Schemats
Generate typescript interface definitions from SQL database schema
Stars: ✭ 799 (+96.8%)
Mutual labels:  schema, postgresql
Postguard
🐛 Statically validate Postgres SQL queries in JS / TS code and derive schemas.
Stars: ✭ 104 (-74.38%)
Mutual labels:  schema, postgresql
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (+2601.23%)
Mutual labels:  schema, postgresql
Pgquarrel
pgquarrel compares PostgreSQL database schemas (DDL)
Stars: ✭ 274 (-32.51%)
Mutual labels:  schema, postgresql
Express Rest Api Boilerplate
Express REST API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 384 (-5.42%)
Mutual labels:  postgresql
Django React Boilerplate
DIY Django + React Boilerplate for starting your SaaS
Stars: ✭ 385 (-5.17%)
Mutual labels:  postgresql
Pg timetable
pg_timetable: Advanced scheduling for PostgreSQL
Stars: ✭ 382 (-5.91%)
Mutual labels:  postgresql
Deno Nessie
A modular Deno library for PostgreSQL, MySQL, MariaDB and SQLite migrations
Stars: ✭ 381 (-6.16%)
Mutual labels:  postgresql
Zson
ZSON is a PostgreSQL extension for transparent JSONB compression
Stars: ✭ 385 (-5.17%)
Mutual labels:  postgresql
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+1007.64%)
Mutual labels:  postgresql
Native
Generate a form using JSON Schema and Vue.js
Stars: ✭ 382 (-5.91%)
Mutual labels:  schema
Micronaut Microservices Poc
Very simplified insurance sales system made in a microservices architecture using Micronaut
Stars: ✭ 394 (-2.96%)
Mutual labels:  postgresql
Shell
Infrastructure Management Shell - Linux
Stars: ✭ 381 (-6.16%)
Mutual labels:  postgresql
Specs
Technical specifications and guidelines for implementing Frictionless Data.
Stars: ✭ 403 (-0.74%)
Mutual labels:  schema
Practical Sql
Code and Data for the book "Practical SQL" by Anthony DeBarros, published by No Starch Press (2018).
Stars: ✭ 392 (-3.45%)
Mutual labels:  postgresql
Postgresql cursor
ActiveRecord PostgreSQL Adapter extension for using a cursor to return a large result set
Stars: ✭ 384 (-5.42%)
Mutual labels:  postgresql
Enferno
A Python framework based on Flask microframework, with batteries included, and best practices in mind.
Stars: ✭ 385 (-5.17%)
Mutual labels:  postgresql

dbdot

dbdot is a command line tool that generates DOT description from postgres database schema.

dbdot is compiled to platform specific binary, so all you need is the right binary for your machine. Grab the appropriate binary for your architecture from the latest release here.

Demos

Demo 1: Produce DOT for all the tables in postgres db pgguide and user kewluser

$ ./dbdot -dbname=pgguide -user=kewluser                                                                                                       [16:33:31]
digraph  {

	node[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD colspan="2">products</TD></TR>[<TR><TD>id</TD><TD>integer</TD></TR> <TR><TD>title</TD><TD>character varying</TD></TR> <TR><TD>price</TD><TD>numeric</TD></TR> <TR><TD>created_at</TD><TD>timestamp with time zone</TD></TR> <TR><TD>deleted_at</TD><TD>timestamp with time zone</TD></TR> <TR><TD>tags</TD><TD>ARRAY</TD></TR>]</TABLE>>,shape=plaintext] n1;
	node[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD colspan="2">purchase_items</TD></TR>[<TR><TD>id</TD><TD>integer</TD></TR> <TR><TD>purchase_id</TD><TD>integer</TD></TR> <TR><TD>product_id</TD><TD>integer</TD></TR> <TR><TD>price</TD><TD>numeric</TD></TR> <TR><TD>quantity</TD><TD>integer</TD></TR> <TR><TD>state</TD><TD>character varying</TD></TR>]</TABLE>>,shape=plaintext] n2;
	node[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD colspan="2">users</TD></TR>[<TR><TD>id</TD><TD>integer</TD></TR> <TR><TD>email</TD><TD>character varying</TD></TR> <TR><TD>password</TD><TD>character varying</TD></TR> <TR><TD>details</TD><TD>USER-DEFINED</TD></TR> <TR><TD>created_at</TD><TD>timestamp with time zone</TD></TR> <TR><TD>deleted_at</TD><TD>timestamp with time zone</TD></TR>]</TABLE>>,shape=plaintext] n3;
	node[label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD colspan="2">purchases</TD></TR>[<TR><TD>id</TD><TD>integer</TD></TR> <TR><TD>created_at</TD><TD>timestamp with time zone</TD></TR> <TR><TD>name</TD><TD>character varying</TD></TR> <TR><TD>address</TD><TD>character varying</TD></TR> <TR><TD>state</TD><TD>character varying</TD></TR> <TR><TD>zipcode</TD><TD>integer</TD></TR> <TR><TD>user_id</TD><TD>integer</TD></TR>]</TABLE>>,shape=plaintext] n4;
	n2->n1;
	n2->n4;
	n4->n3;

}

Demo 2: Produce a schema diagram for all the tables in pgguide db for kewluser

$ ./dbdot -dbname=pgguide -user=kewluser > test.dot && dot -Tpng test.dot -o outfile.png && open outfile.png

Above command pipes the DOT description into test.dot and invokes dot cli tool to transform test.dot to a outfile.png. Here's what outfile.png looks like:

outfile.png

Demo 3: Whitelist tables and produce schema diagram for them

./dbdot -dbname=pgguide -user=kewluser > test.dot --whitelist=purchase_items,purchases && dot -Tpng test.dot -o outfile-whitelisted.png && open outfile-whitelisted.png

Here's what outfile-whitelisted.png looks like:

outfile-whitelisted.png

Flags

dbdot currently supports the following flags:

  -W    ask for password
  -dbname string
        dbname for which you want to generate dot file
  -host string
        database host (default "localhost")
  -port uint
        database port (default 5432)
  -schema string
        schema name (default "public")
  -sslmode
        enable sslmode for postgres db connection
  -user string
        username of postgres db
  -whitelist string
        comma separated list of tables you want to generate dot file for

TODO

Here's some features I would like to have for this project:

  • Support connection string. What happens if the user doesn't have access to db?
  • Add support for more db types.
  • Prettify output.
  • Add ability to whitelist columns in a table. Users should be able whitelist columns per table. But this starts getting into territory of language design. i.e. what kind of cli syntax should dbdot support. Hence this is the last item in my list.

Inspiration

A while back I wanted a simple tool that would just spit out schema for tables that I wanted. A lot of tools I found were way too powerful, requiring a zillion installation and configuration. This inspired me to write a simple self contained tool that was laser focused on just reading schema and spitting out DOT.

Similar projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].