Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

PostgreSQL CREATE TABLE to Pydantic model

Paste a CREATE TABLE, get a Pydantic model. Nothing you paste is stored.

Paste a PostgreSQL CREATE TABLE and get a Pydantic v2 BaseModel. Nullable columns become Optional, NUMERIC maps to Decimal (not float, which corrupts money math), and timestamps become datetime.

The fields come from your real DDL, so the model matches the table you have. Runs on the server and is discarded after the response.

Try it on your own schema

Example

PostgreSQL in:

CREATE TABLE product (
    id BIGSERIAL PRIMARY KEY,
    sku VARCHAR(40) UNIQUE NOT NULL,
    name VARCHAR(200) NOT NULL,
    price NUMERIC(12, 2) NOT NULL,
    in_stock BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMP NOT NULL DEFAULT now()
);

Generated:

product_model.py

from datetime import datetime
from decimal import Decimal

from pydantic import BaseModel


class Product(BaseModel):
    id: int
    sku: str
    name: str
    price: Decimal
    in_stock: bool
    created_at: datetime

Related