Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/blooser/dynatable

Dynamic models for django
https://github.com/blooser/dynatable

django django-rest docker docker-compose mypy poetry postgresql pytest ruff

Last synced: 9 days ago
JSON representation

Dynamic models for django

Awesome Lists containing this project

README

        

# DynaTable ๐Ÿš€

![CI Status](https://github.com/blooser/DynaTable/actions/workflows/docker-image.yml/badge.svg)

**DynaTable** is an innovative dynamic model builder tailored for Django, equipped with a potent REST API interface. It facilitates the on-the-fly creation, updating, and management of database models ๐ŸŒŸ. Crafted meticulously using Django, Django REST Framework, and PostgreSQL, DynaTable stands as an indispensable asset for applications necessitating versatile and dynamic database schema management.

---

## Technologies ๐Ÿ’ป
- [Python](https://www.python.org/)
- [Django](https://www.djangoproject.com/) + [Django REST Framework](https://www.django-rest-framework.org/)
- [PostgreSQL](https://www.postgresql.org/)
- [Docker](https://www.docker.com/)
- [Swagger](https://swagger.io/) and [Redoc](https://redoc.ly/)
- [Pytest](https://docs.pytest.org/en/stable/)
- [Poetry](https://python-poetry.org/)

## Core Features ๐ŸŒˆ

- **Dynamic Model Creation** ๐Ÿ› ๏ธ: Intuitively define and instantiate new database models via a RESTful interface.
- **Model Schema Updates** ๐Ÿ”ง: Seamlessly modify existing models' schemas without the need to adjust the underlying codebase.
- **Efficient Data Manipulation** ๐Ÿ“Š: Dynamically insert and retrieve data rows for any constructed model.
- **RESTful API Excellence** ๐ŸŒ: Capitalize on the robust functionality of Django REST Framework for streamlined API interactions.
- **PostgreSQL Integration** ๐Ÿ’พ: Guarantee strong and dependable data storage solutions with PostgreSQL.

## Build and Run ๐Ÿ—๏ธ

### Building the Application

```bash
$ docker-compose build
```

### Running the Application

```bash
$ docker-compose up -d
```

## Multi-stage Build ๐Ÿ› ๏ธ

DynaTable employs a sophisticated multi-stage building process, encapsulated within Docker for optimal efficiency and performance.

This advanced approach offers several significant benefits:
- Reduced Image Size
- Improved Security
- Optimized Build Caching

## Exploring API Documentation with Swagger/Redoc ๐Ÿ“š

DynaTable simplifies API documentation exploration by utilizing both Swagger and Redoc.

Navigate to:

- Swagger UI

```bash
http://localhost:8000/swagger
```

- Redoc

```bash
http://localhost:8000/redoc
```
---

## Unit Testing with Pytest ๐Ÿงช

The application boasts comprehensive unit test coverage utilizing Pytest.

Execute unit tests with:

```bash
$ docker-compose run test
```

Or run bash script

```
$ ./run_tests.sh
```

## Advanced Data Generation and Testing ๐Ÿ”

**DynaTable** rigorously tests its functionalities using Pytest alongside generated data, ensuring maximum effectiveness. The bespoke [generator](https://github.com/blooser/DynaTable/blob/master/src/tests/generator.py) module proficiently produces random model fields and data rows for database population. This ensures diverse testing scenarios and enhances the overall quality and reliability of the functions.

## Simulation ๐ŸŒ

The **DynaTable** includes a comprehensive [simulation](https://github.com/blooser/DynaTable/blob/master/src/simulation/__main__.py) module designed to show interactions with the server.

To invoke simulation, run

```bash
$ poetry run python src/simulation -t --host
```

Or use script

```bash
$ ./run_simulation.sh
```

---

![sim2](https://github.com/blooser/DynaTable/blob/master/images/sim2.png?raw=true)

# License

This project is licensed under the MIT License - view the [LICENSE.md](https://github.com/blooser/DynaTable/blob/master/LICENSE.md) file for details.