Hochfrequenz / bo4e-python-orm

0 stars 0 forks source link

Python BO4E ORM

Unittests status badge Coverage status badge Linting status badge Black status badge

A ORM tool to map between SQL databases and BO4E classes using:

The idea of this tool is to provide a first instance of an ORM which has been generated from a specific BO4E version. For further information of the functionalities of this ORM framework, please refer to the documentation of SQLModel. Please note that this is a very early version of the ORM and might not be fully functional yet.

Installation

It will also be available on pypi.

pip install borm

Description

To setup a test db (postgresql) run the following in your tox env (see below):

tox -e setup_testpostgresql

Make sure that your local host is running.

Alternatively, an existing bo4e version can be pulled via:

tox -e init_bo4e

This uses two other tools: https://github.com/bo4e/BO4E-Schema-Tool and https://github.com/bo4e/BO4E-Python-Generator

Make sure you specify the version in tox.ini via the -t flag.

The fast way is to use:

tox -e setup_bo4e

which combines the steps above.

Enter the following to delete the test db:

tox -e remove_testpostgresql

In order to get a better understanding how this ORM works, you might want to have a look at the tests in the tests folder.

In principle, alembic migrations are supported, e.g. by running:

tox -e migration

However, this is not further supported at the moment.

Contribute

You are very welcome to contribute to this repository by opening a pull request against the main branch. If you use a windows OS you might need to change psycopg -> psycopg[binary] in the requirements.