Javascript package (npm) to translate your Drizzle ORM schemas into Python (Pydantic/TypedDict/Dataclass)
npm install drizzle-to-python
import { convertToPydantic } from 'drizzle-to-python';
// Your Drizzle schema
const schema = import { pgTable, varchar, integer } from 'drizzle-orm/pg-core';export const users = pgTable('users', { id: integer('id').primaryKey(), name: varchar('name', { length: 256 }), email: varchar('email', { length: 256 })});;
// Convert to Pydantic
const pythonCode = convertToPydantic(schema);
console.log(pythonCode);
from pydantic import BaseModel
from typing import Optional
class User(BaseModel):
id: int
name: Optional[str] = None
email: Optional[str] = None
- Convert Drizzle schema to:
- Pydantic models
- TypedDict
- Dataclasses
- Supports common Drizzle types
- Preserves nullable fields
- Handles relationships
MIT