https://github.com/tameronline/ll-db-builder
https://github.com/tameronline/ll-db-builder
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tameronline/ll-db-builder
- Owner: TamerOnLine
- License: mit
- Created: 2025-06-30T23:00:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-01T00:23:00.000Z (about 1 year ago)
- Last Synced: 2025-07-01T00:33:21.970Z (about 1 year ago)
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ ๏ธ ll-db-builder
**ll-db-builder** is a professional Python project that automatically sets up the PostgreSQL database for Flask-based or general systems using SQLAlchemy.
It loads connection settings from `.env`, ensures the database exists, and creates all required tables based on the defined models in `main/models`.
---
## ๐ Features
- โ
Initializes all tables using SQLAlchemy
- โ
Secure loading of settings via `.env`
- โ
Clean and professional project structure
- โ
Ready to integrate with CI or Flask projects
---
## ๐ Project Structure
```bash
ll-db-builder/
โโโ main/
โ โโโ config/ # Environment and configuration loading
โ โโโ models/ # Database models
โ โโโ extensions.py # SQLAlchemy configuration
โโโ .env # Database connection settings
โโโ build.py # Main script to initialize DB and tables
โโโ requirements.txt # Main project dependencies
โโโ test-requirements.txt # Test-specific dependencies
โโโ README.md # This file
```
---
## โ๏ธ Usage
### 1. Create a virtual environment
```bash
python -m venv venv
venv\Scripts\activate # On Windows
# or
source venv/bin/activate # On Linux/Mac
pip install -r requirements.txt
```
### 2. Configure environment variables
Create a `.env` file in the root directory with:
```env
DB_NAME=ll_db
DB_USER=postgres
DB_PASSWORD=yourpassword
DB_HOST=127.0.0.1
DB_PORT=5432
```
### 3. Run the script
```bash
python build.py
```
---
## ๐งฑ Key Files
| File | Purpose |
|------|---------|
| `build.py` | Entry point โ loads config and builds database/tables |
| `config_loader.py` | Loads environment variables |
| `db_initializer.py` | Ensures DB exists and initializes tables |
| `models/*.py` | SQLAlchemy table definitions |
| `extensions.py` | Defines `db` and `Base` for reuse |
---
## ๐งช Testing (Optional)
```bash
pip install -r test-requirements.txt
pytest
```
---
## ๐ License
MIT License โ See [LICENSE](LICENSE) for details.
---
## ๐จโ๐ป Author
- **Tamer Faour** โ [@TamerOnLine](https://github.com/TamerOnLine)