Coder Social home page Coder Social logo

dbdiagrams's Introduction

dbdiagrams

this tool helps you quickly generate beautiful database/ER diagrams for your postgres db schema :

  • the script auto-generates the code by detecting postgres db schema
  • this code(sample) can be then copy pasted onto an online tool called dbdiagram.io

setup

required : python3, pip3

(NOTE: in case your /usr/bin/python doesn't point to anything then just run sudo ln -s /usr/bin/python3 /usr/bin/python and if you've multiple versions and your python is pointed to python2 and not python3, please use python3/pip3 instead of python/pip in all the steps and change first line of generate_code to #!/usr/bin/env python3

  1. git clone https://github.com/nsingla/dbdiagrams.git

  2. cd dbdiagrams

  3. (optional) - use python virtual environment :

python -m venv env
source /env/bin/activate
  1. install pre-requisite installation for psycopg2 (you could also install postgresql, otherwise libpq-dev and python-dev work):
sudo apt-get install libpq-dev python3-dev 
pip install -r requirements.txt

settings.conf Common parameters

  • conn_string : this is a database connection string setting
  • table_schema : default set to public
  • exclude_views : true/false to include/exclude views in the diagram
  • exclude_tablenames_like : a comma separated list - if any of the table contains one of these text - it will be excluded, leave empty if nothing needs to be excluded
  • output_filepath : this is the file where the output code will be saved into

generating the code

  • update all the Common parameters carefully in settings.conf
  • run ./generate_code
  • copy the generated code from the output file and visit dbdiagram.io website, once on the diagram page - paste it onto the code panel on the left. This should generate the diagram, make sure all the info is as desired - specially the references/table relationships.
  • you can screenshot the diagram and save image file or you can create an account if you like the tool (i've no affiliation) !

dbdiagrams's People

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.