Skip to content

Hochfrequenz/bo4e-python-orm

Repository files navigation

Python BO4E ORM

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

At this point this repository serves only as an exemplary implementation of a BO4E ORM. The main work (i.e. the generation of SQL Model code) will be done in the BO4E-CLI-Tool

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published