Skip to main content

Generate ER diagrams with python and graphviz

Project description

Introduction

The packages allows you to programmatically create ER diagrams. The pacakges is simple, but it should help you generate ER diagrams like the one provided by Chen.

Installation

pip install yaerrrr

Example

A single ER can be generated as follows:

from yaerrrr.AbstarctYaerrrrScript import AbstractYaerrrrScript


class TestEr(AbstractYaerrrrScript):

    def generate_er(self, context: 'models.YaerrrContext') -> "models.ErDiagram":
        er = context.er

        er.add_entity(name="authors", fields=[
            er.generate_primary_id_key(),
        ])
        er.add_entity(name="books", fields=[
            er.generate_primary_id_key()
        ])
        er.add_1_to_0_n("authors", "books", "writes")

        return er


def main():
    x = TestEr()
    x.run("output.svg")


if __name__ == "__main__":
    main()

and it outputs (for now):

ER

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

yaerrrr-1.2.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page