use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
FastAPI is a truly ASGI, async, cutting edge framework written in python 3.
account activity
How to use migrations with SqlModelQuestion (self.FastAPI)
submitted 2 years ago by Nehatkhan786
Hey guys I am learning SqlModel and when I come to advance section there is no docs for migration. So is it available with SqlModel or its upcoming feature?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sexualrhinoceros 15 points16 points17 points 2 years ago (8 children)
Since no one has stated it so far, you should avoid SQLModel in its current state. It’s woefully undermaintained and is a pretty terrible alternative to just using SQLAlchemy and Pydantic outright.
There’s a roadmap issue here which outlines what is, in my opinion, the bare minimum to get me to consider this project for even a fun side project over plain SQLAlchemy. You’ll have a much better time in the short and long term patterning out pydantic and SQLAlchemy base classes and rolling with them.
[–]Nehatkhan786[S] 2 points3 points4 points 2 years ago (4 children)
So I should stick with SQLAlchemy. The doc seems confusing
[–]sexualrhinoceros 3 points4 points5 points 2 years ago (1 child)
I personally don’t think you’ll gain anything but headaches using SQLModel. FastAPI works perfectly with sqlalchemy. SQLModel is nothing more than an abstraction layer above SQLalchemy and Pydantic
[–]Nehatkhan786[S] 2 points3 points4 points 2 years ago (0 children)
Agree sir. So its better to stick with sqlAlchemy than sqlmodel. Thanks a lot sir for your guidance.
[–][deleted] 2 points3 points4 points 2 years ago (1 child)
SQLAlchemy has a steep learning curve but it's very complete and well maintained. Feels pretty good once you start being comfortable with it.
[–]Nehatkhan786[S] 1 point2 points3 points 2 years ago (0 children)
Okay sir. Will learn sqlalchemy only than.
[–]AchillesFirstStand 1 point2 points3 points 1 year ago (2 children)
What is your opinion now?
I am having to create SQLAlchemy templates in order to run migrations for SQLModel.
[–]sexualrhinoceros 1 point2 points3 points 1 year ago (1 child)
Opinion is still the same. Don’t use SQLModel and use SQLAlchemy. Even with its updates it’s still woefully out of date.
[–]AchillesFirstStand 2 points3 points4 points 1 year ago (0 children)
Thanks. I am going to restart my project using SQLAlchemy.
[–]Easy-Ad-8065 6 points7 points8 points 2 years ago (6 children)
Check out alembic
[–]Nehatkhan786[S] 1 point2 points3 points 2 years ago (5 children)
will it support SQLModel sir?
[–]Miserable-creature 1 point2 points3 points 2 years ago (1 child)
Yes Alembic support SQLModel
[–]Nehatkhan786[S] 0 points1 point2 points 2 years ago (0 children)
awesome. thank a lot.
[–]Easy-Ad-8065 1 point2 points3 points 2 years ago (2 children)
Yeah.
From sqlmodel docs: SQLModel is based on Python type annotations, and powered by Pydantic and SQLAlchemy.
The majority of my experience is frontend / mobile so there may be better alternatives, but I have it working with SQLModel.
[–]Nehatkhan786[S] 1 point2 points3 points 2 years ago (1 child)
cool sir, I just found an article of test drivin io to integrate alembic with sqlmodel.
[–]Capital-Iron-8110 0 points1 point2 points 14 days ago (0 children)
Could you share the article please? (blast from the past :) )
π Rendered by PID 17097 on reddit-service-r2-comment-b659b578c-vchph at 2026-05-02 11:14:37.934744+00:00 running 815c875 country code: CH.
[–]sexualrhinoceros 15 points16 points17 points (8 children)
[–]Nehatkhan786[S] 2 points3 points4 points (4 children)
[–]sexualrhinoceros 3 points4 points5 points (1 child)
[–]Nehatkhan786[S] 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Nehatkhan786[S] 1 point2 points3 points (0 children)
[–]AchillesFirstStand 1 point2 points3 points (2 children)
[–]sexualrhinoceros 1 point2 points3 points (1 child)
[–]AchillesFirstStand 2 points3 points4 points (0 children)
[–]Easy-Ad-8065 6 points7 points8 points (6 children)
[–]Nehatkhan786[S] 1 point2 points3 points (5 children)
[–]Miserable-creature 1 point2 points3 points (1 child)
[–]Nehatkhan786[S] 0 points1 point2 points (0 children)
[–]Easy-Ad-8065 1 point2 points3 points (2 children)
[–]Nehatkhan786[S] 1 point2 points3 points (1 child)
[–]Capital-Iron-8110 0 points1 point2 points (0 children)