DHBW-DB_2023_24_App
Version: 1.0 (Final)
This project is a Database Management Web Application for MySQL and MongoDB. It enables importing, converting, resetting, and analyzing data through a user-friendly Flask interface.
- ⚙️ Table Conversion: Migrate MySQL tables to MongoDB (flat or embedded).
- 📥 Data Import (CSV/JSON): Import structured datasets into SQL and NoSQL.
- 🧹 Database Reset: Reset MySQL & MongoDB via one-click web buttons.
- ✏️ Table Editing: View and edit SQL tables directly via web.
- 📊 Report Generation: Predefined analytics on database contents.
- 🔄 Dynamic Reload: Refresh displayed table content via AJAX.
git clone https://github.com/Sahinbascoding/dhbw-db-2425.git
cd dhbw-db-2425
python -m venv .venv
.venv\Scripts\activate # (Windows)
pip install -r requirements.txt
Erstelle anschließend eine
.env
Datei im Root-Verzeichnis:
SECRET_KEY=dein-secret-key
MYSQL_HOST=127.0.0.1
MYSQL_USER=root
MYSQL_PASSWORD=deinpasswort
MYSQL_DB_NAME=dein_db_name
MONGO_HOST=localhost
MONGO_PORT=27017
MONGO_DB_NAME=dein_mongo_db
Dann kannst du die Anwendung starten mit:
flask run
- 🔁 MySQL importieren: Führt
create_shema.sql
,load_data.sql
,data_cleanup.sql
in dieser Reihenfolge aus. - 🧹 MySQL & MongoDB löschen: Leere beide Datenbanken vollständig per Knopfdruck.
- 📦 JSON hochladen: Lade z. B.
unfall.json
manuell hoch und füge Inhalte ein. - 🔄 Konvertieren: Wandle SQL-Daten in MongoDB-Collections um.
Falls gewünscht, kannst du die SQL-Dateien auch manuell ausführen:
mysql -u root -p
SET GLOBAL local_infile = 1;
EXIT;
mysql -u root -p < src/sql/import/create_shema.sql
mysql -u root -p --local-infile=1 < src/sql/import/load_data.sql
mysql -u root -p < src/sql/import/data_cleanup.sql
├── app.py # Entry point – startet Flask + Engine
├── .env # Lokale Konfigurationswerte
├── requirements.txt # Benötigte Pakete
├── src/
│ ├── tools/ # Import-/Reset-Skripte für Datenbanken
│ ├── sql/import/ # SQL-Dateien für Schema, Daten, Cleanup
├── web_app/
│ ├── api/router.py # Zentrale Routing-Registrierung
│ ├── api/routes/ # Einzelrouten wie convert, import, reset...
│ ├── infrastructure/ # config.py + DB-Helper
│ ├── templates/ # HTML-Dateien (Jinja2)
│ ├── static/ # CSS, Images
├── data/ # CSV-/JSON-Beispieldaten
├── doc/ # ER-Modell, Zeichnungen, Fortschritt
Version: 1.0
Stand: 22.04.2025
Contributors:
- 🧑💻 Ata Sahinbas, Luis Kilic
- 🏫 DHBW Stuttgart