sqlmodel
sqlmodel copied to clipboard
📝 Add migrations section
I added the migrations section to use SQLModel with alembic.
- [X] Initial example
- [X] Step by step
- [X] Example codes
📝 Docs preview for commit eb3ca5e95edd4d98392b1130afeece8b4dedaa09 at: https://639a800274ad247dd834e997--sqlmodel.netlify.app
📝 Docs preview for commit 3cf251f15043dd168e75caa878343a4d867d9059 at: https://639a88d88095c57f0274e6fd--sqlmodel.netlify.app
📝 Docs preview for commit feea75f42fa29599179f7d717fe1ef121afd88fa at: https://639a8a3c2fbcf011a10ebd78--sqlmodel.netlify.app
📝 Docs preview for commit 51d83a666c9e48b45b0d105b90865fdd2b1eca6f at: https://639cdd9a18290c00b4ff5209--sqlmodel.netlify.app
📝 Docs preview for commit 3437837fbae77e03ef39c5bbf7f30042cc07da54 at: https://639e7f62ce461c1a81789517--sqlmodel.netlify.app
Hello, is this the recommended approach now? Alembic is a little intimidating to me, so I'd prefer to be ensured that Alembic is the migration tool of choice, and to have a tutorial from SQLModel. The previews are a little scuffed with the code blocks ^^
(@tiangolo)
Hey, it would be nice to have this in the docs. I am trying to get this to work on my project, and there is barely any documentation on how to use Alembic with SQLModel. I've been trying to read it from the CI, but the code examples are omitted.
@locomoco28 Do you know of any other tool to manage migrations? I could not find an alternative, and Alembic seems to be well integrated with sqlalchemy
I found only this: https://www.youtube.com/watch?v=gekC1ESLxPs
I unfortunately do not have any experience with any other migration tooling as I'm coming from the NodeJS world and wanted to use SQLModel for pretty much my first Python project at work.
Thank you for the resource, I'll look into it in the coming days as we're prioritizing a first running beta for now only :)
I unfortunately do not have any experience with any other migration tooling as I'm coming from the NodeJS world and wanted to use SQLModel for pretty much my first Python project at work.
Thank you for the resource, I'll look into it in the coming days as we're prioritizing a first running beta for now only :)
Hello! see my example in https://github.com/ezeparziale/fastapi-sqlmodel
The secret is config the env.py from alembic, then is only run alembic revision --autogenerate - m "my_message"
, and finally alembic upgrade head
Hey, thank you both for the resources. It really was easy to set up. I'm using asyncpg (with create_async_engine
from sqlalchemy) so my connection uri is postgresql+asyncpg://
which required me to run initialize Alembic using the -t async
flag according to this cookbook I found: https://alembic.sqlalchemy.org/en/latest/cookbook.html#using-asyncio-with-alembic
Appreciate your help!
alembic seems like not work well with sqllite, because that sqllite does not support alter method.
alembic seems like not work well with sqllite, because that sqllite does not support alter method.
https://sqlite.org/lang_altertable.html it does?
alembic seems like not work well with sqllite, because that sqllite does not support alter method.
https://alembic.sqlalchemy.org/en/latest/batch.html