Schemint

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

MySQL CREATE TABLE to Pydantic model

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

Paste a MySQL CREATE TABLE and get a Pydantic v2 BaseModel. TINYINT(1) maps to bool, DECIMAL to Decimal (not float, which corrupts money math), DATETIME to datetime, and nullable columns become Optional.

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

MySQL in:

CREATE TABLE `product` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `sku` VARCHAR(40) NOT NULL,
    `name` VARCHAR(200) NOT NULL,
    `price` DECIMAL(12, 2) NOT NULL,
    `in_stock` TINYINT(1) NOT NULL DEFAULT 1,
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_product_sku` (`sku`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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