https://github.com/sphinx-contrib/sqlalchemyviz
SqlAlchemyViz Sphinx Extension
https://github.com/sphinx-contrib/sqlalchemyviz
Last synced: 1 day ago
JSON representation
SqlAlchemyViz Sphinx Extension
- Host: GitHub
- URL: https://github.com/sphinx-contrib/sqlalchemyviz
- Owner: sphinx-contrib
- License: bsd-2-clause
- Created: 2016-01-09T16:21:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-20T04:11:31.000Z (almost 6 years ago)
- Last Synced: 2025-06-07T03:03:08.187Z (24 days ago)
- Language: Python
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
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 :.. code-block:: bash
sqlaviz --unique-relations --show-constraints -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 :.. code-block:: bash
sqlaviz -p neato --unique-relations -f out.dot
ccomps -x out.dot | dot | gvpack -array3 | neato -Tpng -n2 -o out.pngThis 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 :.. code-block:: bash
sqlaviz -p neato --unique-relations -o node_margin='"0,0"' -f out.dot
Installation & Usage
--------------------This extension can be installed from pypi :
.. code-block:: bash
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 :.. code-block:: rest
.. sqlaviz::
:metadataobject: full.importable.path.of.metadataFor 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.metadataLicense
-------This Sphinx Extension is made available under the BSD 2-clause License. See
the LICENSE file for the full text.