SchemaForge v0.5.0: SQLAlchemy Support
We're excited to announce SchemaForge v0.5.0, adding full SQLAlchemy declarative model support. This completes the set: SchemaForge now converts bidirectionally between all six major ORM formats with roundtrip verification of supported schema elements. Foreign keys and ORM relationships are not preserved by the current converter.
What's New in v0.5.0
- SQLAlchemy declarative models — import and export
declarative_base()models with supported columns, types, indexes and constraints; ORM relationships are not preserved - Bidirectional SQLAlchemy conversion — convert to SQLAlchemy from supported import formats, and from SQLAlchemy to supported targets (Alembic is export only)
- Demo fixtures — the
fixtures/directory now includes a blog schema in all 6 formats so you can try SchemaForge immediately - All direction pairs — every format can convert to every other format (that's 30 possible conversion paths)
pip install --upgrade git+https://github.com/Coding-Dev-Tools/schemaforge.git and you're done.
SQLAlchemy → Prisma in One Command
Here's the kind of migration SchemaForge now handles. Say you have a SQLAlchemy model:
# models.py
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, DateTime
from sqlalchemy.orm import declarative_base, relationship
from datetime import datetime
Base = declarative_base()
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
email = Column(String(255), unique=True, nullable=False)
name = Column(String(100), nullable=False)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime, default=datetime.utcnow)
posts = relationship("Post", back_populates="author")
class Post(Base):
__tablename__ = "posts"
id = Column(Integer, primary_key=True)
title = Column(String(200), nullable=False)
body = Column(String, nullable=False)
published = Column(Boolean, default=False)
author_id = Column(Integer, ForeignKey("users.id"))
author = relationship("User", back_populates="posts")
Convert to Prisma. The scalar columns remain; foreign-key constraints and ORM relationships in the input are dropped. Review the output before applying it:
model User {
id Int @id @default(autoincrement())
email String @unique
name String
is_active Boolean @default(true)
created_at DateTime @default(now())
}
model Post {
id Int @id @default(autoincrement())
title String
body String
published Boolean @default(false)
author_id Int
}
Or to Drizzle:
import { pgTable, serial, varchar, boolean, timestamp, integer } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
id: serial("id").primaryKey(),
email: varchar("email", { length: 255 }).unique().notNull(),
name: varchar("name", { length: 100 }).notNull(),
isActive: boolean("is_active").default(true),
createdAt: timestamp("created_at").defaultNow(),
});
export const posts = pgTable("posts", {
id: serial("id").primaryKey(),
title: varchar("title", { length: 200 }).notNull(),
body: varchar("body").notNull(),
published: boolean("published").default(false),
authorId: integer("author_id"),
});
Or to Django models, TypeORM entities, or SQL DDL — all with the same command pattern.
Conversion Matrix
All 30 direction pairs now work:
| → SQL | → Prisma | → Drizzle | → TypeORM | → Django | → SQLAlchemy | |
|---|---|---|---|---|---|---|
| SQL DDL → | — | ✓ | ✓ | ✓ | ✓ | ✓ |
| Prisma → | ✓ | — | ✓ | ✓ | ✓ | ✓ |
| Drizzle → | ✓ | ✓ | — | ✓ | ✓ | ✓ |
| TypeORM → | ✓ | ✓ | ✓ | — | ✓ | ✓ |
| Django → | ✓ | ✓ | ✓ | ✓ | — | ✓ |
| SQLAlchemy → | ✓ | ✓ | ✓ | ✓ | ✓ | — |
Schema Diffing
v0.5.0 also includes schema diffing — compare two schemas in the same format to see what changed:
═══ Schema Diff ═══
Added:
table "categories" (id, name, slug)
Modified:
table "posts"
+ column "category_id" (Int, nullable)
~ column "body": String(200) → Text
Removed:
column "posts.is_pinned"
Demo Fixtures
Want to try it right now? The repo includes a blog schema in all 6 formats:
No need to understand Prisma syntax to get Django models — SchemaForge does the translation.
Release Notes Summary
| Feature | Status |
|---|---|
| SQLAlchemy declarative model parser | ✅ v0.5.0 |
| SQLAlchemy declarative model generator | ✅ v0.5.0 |
| Demo fixtures in all 6 formats | ✅ v0.5.0 |
| Schema diff command | ✅ v0.2.0 |
| Batch directory conversion | ✅ v0.2.0 |
| 40+ passing tests | ✅ v0.5.0 |
| 30 bidirectional conversion paths | ✅ v0.5.0 |
Next Steps
Try SchemaForge today — it's free and open source (Apache 2.0):
Read the original v0.2.0 launch post for more on Drizzle support and batch conversion.
SchemaForge is one of 11 tools in the DevForge suite. Check out the others:
- API Contract Guardian — Catch breaking API schema changes in PRs
- json2sql — Convert JSON files to SQL INSERT statements (tutorial)
- ConfigDrift — Detect config drift before it breaks production (tutorial)
- DeployDiff — Preview infra costs and blast radius (tutorial)
Stay Updated
Get notified about new releases and tutorials.