FastAPI schema diff — free to use

FastAPI Schema Diff.
Compare Alembic migrations.
Zero setup.

Paste two CREATE TABLE dumps from your FastAPI app — whether from alembic upgrade head output, SQLModel sync, SQLAlchemy reflect, or raw SQL. Spot every table, column, index, and constraint change instantly. Get ready-to-run ALTER TABLE scripts for PostgreSQL or MySQL — all in your browser.

No account required. No data leaves your device.

Built for FastAPI & Python workflows

SchemaLens understands Python-specific patterns that generic diff tools miss.

🐍

Alembic Migration Review

Compare alembic revision --autogenerate outputs before and after model changes. Verify that SQLAlchemy migrations produced exactly the schema you expected.

📐

SQLModel & Pydantic Sync

Diff schemas generated from SQLModel tables with Pydantic-validated columns. Detects Optional[int]int nullability changes and Field default modifications.

🗂️

SQLAlchemy Column Changes

Detects String(50)Text(), IntegerBigInteger, and Enum value changes. Warns when length reductions could truncate data.

🔗

Relationship & Foreign Key

Validates relationship() and ForeignKey constraints. Detects missing or changed foreign keys that could break FastAPI's dependency-injected database sessions.

🧬

Enum & Check Constraint

Compares PostgreSQL ENUM types and CheckConstraint declarations. Catches schema drift that breaks Pydantic model validation or OpenAPI schema generation.

🔒

Privacy First

Your schema never leaves the browser. Compare production FastAPI schemas safely without uploading sensitive table structures to a third-party server.

How it works with FastAPI

1

Dump your schemas

Run alembic upgrade head --sql or use pg_dump --schema-only on both environments (local vs staging, or staging vs production).

2

Paste into SchemaLens

Copy the SQL into the two editor panes. Dialect auto-detects PostgreSQL or MySQL based on your DATABASE_URL in .env.

3

Review the diff

See added tables, dropped columns, type changes, and constraint modifications highlighted in color. Check for breaking changes before your next deploy.

4

Copy the migration

Export ALTER TABLE scripts, save as Markdown for PR descriptions, or generate rollback SQL. Run in staging, then production.

FastAPI migration examples

SchemaLens generates production-ready ALTER TABLE scripts for every change it detects.

Add a new column

ALTER TABLE users
  ADD COLUMN is_active BOOLEAN DEFAULT TRUE;

Extend enum values

ALTER TYPE status_enum ADD VALUE 'archived';
ALTER TABLE posts
  ALTER COLUMN status TYPE status_enum;

Add a foreign key

ALTER TABLE comments
  ADD CONSTRAINT comments_post_id_fkey
  FOREIGN KEY (post_id) REFERENCES posts(id)
  ON DELETE CASCADE;

Add a check constraint

ALTER TABLE products
  ADD CONSTRAINT chk_price_positive
  CHECK (price >= 0);

Related guides

Ready to diff your FastAPI schemas?

A privacy-first schema diff tool. No account required.

Start Comparing Free

Free forever — unlimited tables. Pro power features — $39 once.