Generate Pydantic models and FastCRUD routers from database schema
Project description
crudzilla
Generate Pydantic models and FastCRUD routers from your PostgreSQL database schema.
Installation
pip install crudzilla
# or
uv add crudzilla
Quick Start
export DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
crudzilla # Pydantic models only
crudzilla --generate-routers # Include FastCRUD routers
crudzilla --generate-routers --include-sqlalchemy # Full generation
Options
| Option | Description |
|---|---|
-o, --output-dir |
Output directory for models (default: generated_models) |
--routers-dir |
Output directory for routers (default: src/app/routers/generated) |
--env-file |
Path to .env file containing DATABASE_URL |
--schema |
Database schema (default: public) |
--exclude-tables |
Tables to exclude (supports wildcards: audit_*, *_log) |
--include-sqlalchemy |
Generate SQLAlchemy models |
--generate-routers |
Generate FastCRUD routers |
--async-mode |
Generate async CRUD operations |
--dry-run |
Preview without writing files |
--backup |
Backup existing files before overwriting |
-v, --verbose |
Verbose output |
Output Structure
generated_models/
├── fastapi/
│ └── schema_public_latest.py # Pydantic schemas
└── sqlalchemy_models.py # SQLAlchemy models
src/app/routers/generated/
└── generated.py # FastCRUD routers
Usage in FastAPI
from fastapi import FastAPI
from src.app.routers.generated.generated import register_generated_routers
app = FastAPI()
register_generated_routers(app, prefix="/api/v1/db")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
crudzilla-0.1.0.tar.gz
(14.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
crudzilla-0.1.0-py3-none-any.whl
(15.2 kB
view details)
File details
Details for the file crudzilla-0.1.0.tar.gz.
File metadata
- Download URL: crudzilla-0.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95974cfdee323aa068870aa64d44178fa0d26ff912b2fdce399f2315e81b4521
|
|
| MD5 |
9cb2253f1edf803da4d1198b8f3dddbb
|
|
| BLAKE2b-256 |
f2cfaac2751c72fc6d7acec42c907947bfdad63b3f39afd416bdc7cd52e0ec14
|
File details
Details for the file crudzilla-0.1.0-py3-none-any.whl.
File metadata
- Download URL: crudzilla-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11d5152be349a18cc2b1336df24d6c7ab8e5daee1377d3e50fc7d4d9bde14114
|
|
| MD5 |
5a1f952b4926e30dd83c1ba9eddeaa67
|
|
| BLAKE2b-256 |
27ec41913676371a98835d74b7bc5410792926b1dcbcec1ca5966ef471f2625b
|