'How to get Alembic to recognise SQLModel database model?

Using SQLModel how to get alembic to recognise the below model?

from sqlmodel import Field, SQLModel

class Hero(SQLModel, table=True):
    id: int = Field(default=None, primary_key=True)
    name: str
    secret_name: str
    age: Optional[int] = None

One approach I've been looking at is to import the SQLalchemy model for Alembic but looking through the source code I can't find how to do that.

How to make Alembic work with SQLModel models?



Solution 1:[1]

Here you can find a fastapi-alembic and SQLmodel integration with async PostgreSQL database https://github.com/jonra1993/fastapi-sqlmodel-alembic

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jonathan Vargas