Generate SQLAlchemy models from database schema
Generate complete SQLAlchemy models by reflecting your PostgreSQL/Supabase database schema. It automatically creates model classes with proper relationships, type mappings, constraints, and Supabase-specific optimizations.
/plugin marketplace add kivo360/claude-toolbelt/plugin install asyncpg-to-sqlalchemy-converter@claude-toolbeltGenerate SQLAlchemy models from database schema
This command connects to your database (PostgreSQL/Supabase), reflects the schema structure, and generates complete SQLAlchemy model definitions with proper relationships, constraints, and type mappings.
/generate-sqlalchemy-models [options]
--url <connection_string>: Database connection string (or uses SUPABASE_URL env var)--schema <name>: Schema to reflect (default: public)--output <file>: Output file for generated models (default: models.py)--base-class <name>: Base class for all models (default: Base)--lazy-load: Enable lazy loading for large schemas--include-extensions: Include table relationships from database extensions--supabase-optimize: Optimize for Supabase-specific features (RLS, UUIDs, etc.)Generate models from Supabase:
/generate-sqlalchemy-models --url "postgresql+asyncpg://user:pass@host:5432/db" --supabase-optimize
Generate for specific schema with lazy loading:
/generate-sqlalchemy-models --schema analytics --output analytics_models.py --lazy-load
Reflect all schemas with extensions:
/generate-sqlalchemy-models --include-extensions --base-class CustomBase
The command generates: