Feature Request: Dynamically generate code for SQLModels from existing Pydantic models #1566
Unanswered
chitralverma
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Problem
In many projects, Pydantic models are the source of truth, especially when they come from an external library.
Currently,
sqlmodel
requires models to extend SQLModel (or Base), which means duplicating models or modifying upstream code.This creates friction when:
Proposed Solution
Provide a function or helper to generate a SQLModel (or plain SQLAlchemy declarative model) from an existing Pydantic model, without requiring decorators or inheritance.
Benefits
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.24
Python Version
Python 3.13.5
Additional Context
I checked around to see if something is already available on these lines but couldn't find anything.
Beta Was this translation helpful? Give feedback.
All reactions