SQL to ORM Code Converter
Convert CREATE TABLE DDL into idiomatic ORM models for Prisma, Sequelize, TypeORM, Drizzle, SQLAlchemy, and Django — fully offline in your browser. Maps types, nullability, defaults, primary/foreign keys, unique & index constraints, and enums, with snake_case ↔ camelCase field mapping via @map / column-name decorators. Unmappable constructs are flagged, never silently dropped.
About SQL to ORM Code Converter
Convert CREATE TABLE DDL into idiomatic ORM models for Prisma, Sequelize, TypeORM, Drizzle, SQLAlchemy, and Django — fully offline in your browser. Maps types, nullability, defaults, primary/foreign keys, unique & index constraints, and enums, with snake_case ↔ camelCase field mapping via @map / column-name decorators. Unmappable constructs are flagged, never silently dropped. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
How does the SQL to ORM converter work?
Paste your CREATE TABLE DDL (one or many statements) and the converter parses columns, types, nullability, defaults, primary keys, foreign keys, unique constraints, indexes, and enums. It then runs deterministic templates per target ORM — Prisma schema, Sequelize models, TypeORM entities, Drizzle tables, SQLAlchemy models, or Django models — generating idiomatic code with relations, mapping decorators, and inline notes where a construct cannot be mapped cleanly.
Which ORMs are supported and how accurate are the mappings?
Six targets: Prisma, Sequelize, TypeORM, Drizzle, SQLAlchemy, and Django. A curated type-mapping table covers the common SQL types (int, bigint, varchar, char, text, decimal, numeric, float, double, bool, date, time, datetime, timestamp, json, blob, uuid, enum). Foreign keys become ORM relations with proper back-references; composite primary keys are supported; snake_case columns are mapped to camelCase fields with @map / column-name decorators so the underlying database column is preserved.
Does the tool need a live database connection?
No. Unlike `prisma db pull` or `sqlacodegen`, this converter works entirely offline from pasted DDL — no DB connection, no introspection, no credentials. Everything runs in your browser, and the same DDL always produces the same output (deterministic templates, no AI guessing).
How are foreign keys, self-referential relations, and many-to-many handled?
Each foreign key becomes a `@relation` / `hasMany` / `belongsTo` (or equivalent) with a back-reference on the parent table. Self-referential foreign keys are detected (e.g., `parent_id` referencing the same table) and labelled `@relation("self")` or named explicitly. Many-to-many via an explicit join table renders as two belongsTo on the join model (no implicit Prisma m-n guessing). Check constraints and partial indexes are flagged in the notes rather than silently dropped.
What extras does this converter offer versus others?
(1) Six ORM targets from one DDL paste. (2) Curated type mapping (40+ types). (3) PK / FK / unique / index / enum detection. (4) Composite primary keys. (5) snake_case → camelCase field naming with @map decorators. (6) Self-referential FK detection. (7) Defaults preserved as raw expressions. (8) Per-target inline notes for unmappable constructs. (9) Naming-strategy toggle (preserve / camelCase). (10) Tabbed output per ORM with copy + download per file. (11) Relation summary preview. (12) Three DDL presets. (13) localStorage history (max 20). (14) Shareable URL with base64-encoded DDL + options. (15) Honesty banner: 'Always test generated models against your schema.'
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.