[![license](https://img.shields.io/badge/License-Apache%202.0-yellow?logo=opensourceinitiative&logoColor=white)](LICENSE)
[![PyPI - Version](https://img.shields.io/pypi/v/eralchemy?logo=pypi&logoColor=white)](https://pypi.org/project/ERAlchemy/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/eralchemy?logo=pypi&logoColor=white)](https://pypi.org/project/eralchemy/)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/eralchemy/eralchemy/unit.yaml?logo=github&logoColor=white)](https://github.com/eralchemy/eralchemy/actions/workflows/unit.yaml)
[![Codecov](https://img.shields.io/codecov/c/github/eralchemy/eralchemy?logo=codecov&logoColor=white)](https://app.codecov.io/gh/eralchemy/eralchemy)
# Entity relation diagrams generator
eralchemy generates Entity Relation (ER) diagram (like the one below) from databases or from SQLAlchemy models.
## Example
![Example for a graph](https://raw.githubusercontent.com/eralchemy/eralchemy/main/docs/_static/forum.svg "Example for a simple Forum")
## Quick Start
### Install
To install eralchemy, just do:
$ pip install eralchemy
### Graph library flavors
To create Pictures and PDFs, eralchemy relies on either graphviz or pygraphviz.
You can use either
$ pip install eralchemy[graphviz]
or
$ pip install eralchemy[pygraphviz]
to retrieve the correct dependencies.
The `graphviz` library is the default if both are installed.
`eralchemy` requires [GraphViz](http://www.graphviz.org/download) to generate the graphs and Python. Both are available for Windows, Mac and Linux.
For Debian based systems, run:
$ apt install graphviz libgraphviz-dev
before installing eralchemy.
### Install using conda
There is also a packaged version in conda-forge, which directly installs the dependencies:
$ conda install -c conda-forge eralchemy
### Usage from Command Line
#### From a database
$ eralchemy -i sqlite:///relative/path/to/db.db -o erd_from_sqlite.pdf
The database is specified as a [SQLAlchemy](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls)
database url.
#### From a markdown file.
$ curl 'https://raw.githubusercontent.com/eralchemy/eralchemy/main/example/forum.er' > markdown_file.er
$ eralchemy -i 'markdown_file.er' -o erd_from_markdown_file.pdf
#### From a Postgresql DB to a markdown file excluding tables named `temp` and `audit`
$ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -o filtered.er --exclude-tables temp audit
#### From a Postgresql DB to a markdown file excluding columns named `created_at` and `updated_at` from all tables
$ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -o filtered.er --exclude-columns created_at updated_at
#### From a Postgresql DB to a markdown file for the schemas `schema1` and `schema2`
$ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -s "schema1, schema2"
#### Specify Output Mode
$ eralchemy -i 'markdown_file.er' -o erd_from_markdown_file.md -m mermaid_er
### Usage from Python
```python
from eralchemy import render_er
## Draw from SQLAlchemy base
render_er(Base, 'erd_from_sqlalchemy.png')
## Draw from database
render_er("sqlite:///relative/path/to/db.db", 'erd_from_sqlite.png')
```
## Architecture
![Architecture schema](https://raw.githubusercontent.com/eralchemy/eralchemy/main/docs/_static/eralchemy_architecture.png "Architecture schema")
Thanks to it's modular architecture, it can be connected to other ORMs/ODMs/OGMs/O\*Ms.
## Contribute
Every feedback is welcome on the [GitHub issues](https://github.com/eralchemy/eralchemy/issues).
### Development
Install the development dependencies using
$ pip install -e .[ci,dev]
Make sure to run the pre-commit to fix formatting
$ pre-commit run --all
All tested PR are welcome.
## Running tests
This project uses the pytest test suite.
To run the tests, use : `$ pytest` or `$ tox`.
Some tests require having a local PostgreSQL database with a schema named test in a database
named test all owned by a user named eralchemy with a password of eralchemy.
If docker compose is available, one can use `docker compose up -d` for this purpose.
You can deselect the tests which require a PostgreSQL database using:
$ pytest -m "not external_db"
## Publishing a release
$ rm -r dist && python -m build && python3 -m twine upload --repository pypi dist/*
## Notes
ERAlchemy was inspired by [erd](https://github.com/BurntSushi/erd), though it is able to render the ER diagram directly
from the database and not just only from the `ER` markup language.
Released under an Apache License 2.0
Raw data
{
"_id": null,
"home_page": null,
"name": "eralchemy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "sql, ORM, relational databases, ER diagram, render",
"author": null,
"author_email": "Alexis Benoist <Alexis-benoist@users.noreply.github.com>, Florian Maurer <fmaurer@disroot.org>",
"download_url": "https://files.pythonhosted.org/packages/19/05/5f69930e83a02360d9ed16660bdd58d9d501bffabd43d7dbbe8c14269143/eralchemy-1.5.0.tar.gz",
"platform": null,
"description": "[![license](https://img.shields.io/badge/License-Apache%202.0-yellow?logo=opensourceinitiative&logoColor=white)](LICENSE)\n[![PyPI - Version](https://img.shields.io/pypi/v/eralchemy?logo=pypi&logoColor=white)](https://pypi.org/project/ERAlchemy/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/eralchemy?logo=pypi&logoColor=white)](https://pypi.org/project/eralchemy/)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/eralchemy/eralchemy/unit.yaml?logo=github&logoColor=white)](https://github.com/eralchemy/eralchemy/actions/workflows/unit.yaml)\n[![Codecov](https://img.shields.io/codecov/c/github/eralchemy/eralchemy?logo=codecov&logoColor=white)](https://app.codecov.io/gh/eralchemy/eralchemy)\n\n# Entity relation diagrams generator\n\neralchemy generates Entity Relation (ER) diagram (like the one below) from databases or from SQLAlchemy models.\n\n## Example\n\n![Example for a graph](https://raw.githubusercontent.com/eralchemy/eralchemy/main/docs/_static/forum.svg \"Example for a simple Forum\")\n\n## Quick Start\n\n### Install\n\nTo install eralchemy, just do:\n\n $ pip install eralchemy\n\n### Graph library flavors\n\nTo create Pictures and PDFs, eralchemy relies on either graphviz or pygraphviz.\n\nYou can use either\n\n $ pip install eralchemy[graphviz]\n\nor\n\n $ pip install eralchemy[pygraphviz]\n\nto retrieve the correct dependencies.\nThe `graphviz` library is the default if both are installed.\n\n`eralchemy` requires [GraphViz](http://www.graphviz.org/download) to generate the graphs and Python. Both are available for Windows, Mac and Linux.\n\nFor Debian based systems, run:\n\n $ apt install graphviz libgraphviz-dev\n\nbefore installing eralchemy.\n\n### Install using conda\n\nThere is also a packaged version in conda-forge, which directly installs the dependencies:\n\n $ conda install -c conda-forge eralchemy\n\n### Usage from Command Line\n\n#### From a database\n\n $ eralchemy -i sqlite:///relative/path/to/db.db -o erd_from_sqlite.pdf\n\nThe database is specified as a [SQLAlchemy](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls)\ndatabase url.\n\n#### From a markdown file.\n\n $ curl 'https://raw.githubusercontent.com/eralchemy/eralchemy/main/example/forum.er' > markdown_file.er\n $ eralchemy -i 'markdown_file.er' -o erd_from_markdown_file.pdf\n\n#### From a Postgresql DB to a markdown file excluding tables named `temp` and `audit`\n\n $ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -o filtered.er --exclude-tables temp audit\n\n#### From a Postgresql DB to a markdown file excluding columns named `created_at` and `updated_at` from all tables\n\n $ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -o filtered.er --exclude-columns created_at updated_at\n\n#### From a Postgresql DB to a markdown file for the schemas `schema1` and `schema2`\n\n $ eralchemy -i 'postgresql+psycopg2://username:password@hostname:5432/databasename' -s \"schema1, schema2\"\n\n#### Specify Output Mode\n\n $ eralchemy -i 'markdown_file.er' -o erd_from_markdown_file.md -m mermaid_er\n\n### Usage from Python\n\n```python\nfrom eralchemy import render_er\n## Draw from SQLAlchemy base\nrender_er(Base, 'erd_from_sqlalchemy.png')\n\n## Draw from database\nrender_er(\"sqlite:///relative/path/to/db.db\", 'erd_from_sqlite.png')\n```\n\n## Architecture\n\n![Architecture schema](https://raw.githubusercontent.com/eralchemy/eralchemy/main/docs/_static/eralchemy_architecture.png \"Architecture schema\")\n\nThanks to it's modular architecture, it can be connected to other ORMs/ODMs/OGMs/O\\*Ms.\n\n## Contribute\n\nEvery feedback is welcome on the [GitHub issues](https://github.com/eralchemy/eralchemy/issues).\n\n### Development\n\nInstall the development dependencies using\n\n $ pip install -e .[ci,dev]\n\nMake sure to run the pre-commit to fix formatting\n\n $ pre-commit run --all\n\nAll tested PR are welcome.\n\n## Running tests\n\nThis project uses the pytest test suite.\nTo run the tests, use : `$ pytest` or `$ tox`.\n\nSome tests require having a local PostgreSQL database with a schema named test in a database\nnamed test all owned by a user named eralchemy with a password of eralchemy.\nIf docker compose is available, one can use `docker compose up -d` for this purpose.\nYou can deselect the tests which require a PostgreSQL database using:\n\n $ pytest -m \"not external_db\"\n\n## Publishing a release\n\n $ rm -r dist && python -m build && python3 -m twine upload --repository pypi dist/*\n\n## Notes\n\nERAlchemy was inspired by [erd](https://github.com/BurntSushi/erd), though it is able to render the ER diagram directly\nfrom the database and not just only from the `ER` markup language.\n\nReleased under an Apache License 2.0\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Simple entity relation (ER) diagrams generation",
"version": "1.5.0",
"project_urls": {
"homepage": "https://github.com/eralchemy/eralchemy",
"repository": "https://github.com/eralchemy/eralchemy"
},
"split_keywords": [
"sql",
" orm",
" relational databases",
" er diagram",
" render"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "10ba3cdc8433aa3d4afc95dd302c2a21611b90cc5b3ebbff5a4889bf6b2e3bdd",
"md5": "6f73182eb460e50fa9be0c79d57b36dc",
"sha256": "c87099aa1a4ac313df690cbe4eb642b596a635fc6b578f7963ce9570994dccc8"
},
"downloads": -1,
"filename": "eralchemy-1.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f73182eb460e50fa9be0c79d57b36dc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19301,
"upload_time": "2024-09-17T11:34:31",
"upload_time_iso_8601": "2024-09-17T11:34:31.211192Z",
"url": "https://files.pythonhosted.org/packages/10/ba/3cdc8433aa3d4afc95dd302c2a21611b90cc5b3ebbff5a4889bf6b2e3bdd/eralchemy-1.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "19055f69930e83a02360d9ed16660bdd58d9d501bffabd43d7dbbe8c14269143",
"md5": "885d19c8d3c7f2de6578560de65c0a82",
"sha256": "fa66a3cd324abd27ad8e65908d7af48d8198c0c185aeb22189cf40516de25941"
},
"downloads": -1,
"filename": "eralchemy-1.5.0.tar.gz",
"has_sig": false,
"md5_digest": "885d19c8d3c7f2de6578560de65c0a82",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24847,
"upload_time": "2024-09-17T11:34:32",
"upload_time_iso_8601": "2024-09-17T11:34:32.651667Z",
"url": "https://files.pythonhosted.org/packages/19/05/5f69930e83a02360d9ed16660bdd58d9d501bffabd43d7dbbe8c14269143/eralchemy-1.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-17 11:34:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eralchemy",
"github_project": "eralchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "eralchemy"
}