Giter VIP home page Giter VIP logo

sqlalchemyviz's Introduction

SQLAlchemyViz Sphinx Extension

This file provides a Sphinx extension to include an Entity-Relationship diagram of SQLAlchemy metadata, generated by the SQLAlchemyViz package. This is a highly unpolished extension which does almost no heavy lifting, and not portable across platforms. The SQLALchemyViz package converts the SQLAlchemy metadata object into a dot file. The extension then uses POSIX/Linux tools via python's subprocess mechanisms to improve the layout of the graph.

To achieve the same effect directly from the shell, the relevant commands would be :

sqlaviz --unique-relations --show-constraints <pkg.module:metadata> -f out.dot
ccomps -x out.dot | dot | gvpack -array3 | neato -Tpng -n2 -o out.png

Note

Some metadata models make SQLAlchemyViz hit a bug in graphviz/dot. In order to work around this, the rendering commands have been switched in v0.2 to :

sqlaviz -p neato --unique-relations <pkg.module:metadata> -f out.dot
ccomps -x out.dot | dot | gvpack -array3 | neato -Tpng -n2 -o out.png

This change will hopefully be rolled back at some point, once the underlying bugs have been resolved.

Note

Recent update(s) to SQLAlchemyViz / pydot creates a syntax error in the generated .dot file. This is worked around by changing the sqlaviz command in v0.3 to :

sqlaviz -p neato --unique-relations <pkg.module:metadata> -o node_margin='"0,0"' -f out.dot

Installation & Usage

This extension can be installed from pypi :

pip install sphinxcontrib-sqlalchemyviz

Add the sphinxcontrib.sqlalchemyviz to Sphinx's list of extensions on the conf.py

In the .rst file where the table should appear, insert the Sphinx directive provided by this module :

.. sqlaviz::
    :metadataobject: full.importable.path.of.metadata

For a basic usage example, see:

Python:https://github.com/chintal/tendril/blob/master/tendril/utils/db.py#L201
Generated:http://tendril.chintal.in/doc/apidoc/tendril.utils.db/#tendril.utils.db.metadata

License

This Sphinx Extension is made available under the BSD 2-clause License. See the LICENSE file for the full text.

sqlalchemyviz's People

Contributors

chintal avatar tzulberti-jampp avatar

Watchers

 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.