Alembic Introduction - Migrations and Auto-Generating Revisions from SQLAlchemy Models

This video introduces Alembic, which is a migration package in Python for managing changes to your databases.
We'll look at how to setup a Migration Environment and define revisions with upgrade and downgrade operations. We'll also look at how to integrate Alembic with SQLAlchemy models, and how to use this to autogenerate revisions.
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugbytes
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:01 Setting up PostgreSQL database container (Docker)
04:09 Installing Alembic
04:43 Creating Alembic Migration Environment
06:40 Connecting Alembic to Database with Connection String
07:49 Creating revision with alembic revision command
16:47 Alembic history, downgrades and relative migrations
20:07 Autogenerating migrations from SQLAlchemy Model Classes
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: bugbytes.io/posts/
👾 Github: github.com/bugbytes-io/
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Docker Postgres Image: hub.docker.com/_/postgres
Alembic: alembic.sqlalchemy.org/en/lat...
Alembic Tutorial: alembic.sqlalchemy.org/en/lat...
Alembic Autogenerating Migrations: alembic.sqlalchemy.org/en/lat...
#python #webdevelopment

Пікірлер: 54

  • @bugbytes3923
    @bugbytes39233 ай бұрын

    Learn to use Alembic with FastAPI! kzread.info/dash/bejne/rIiHz9iOhsXRaLA.html

  • @michaelmaguire6709
    @michaelmaguire670911 күн бұрын

    Just found your channel and am very impressed by the content and quality. Thank you for putting this together and presenting it so clearly.

  • @bugbytes3923

    @bugbytes3923

    6 күн бұрын

    Thanks a lot Michael! Delighted to hear that, cheers.

  • @rje4242
    @rje42427 ай бұрын

    BugBytes is first tier content on youtube. Love your content on FastAPI, Alpine and HTMX !

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    Thanks a lot! Really appreciate that.

  • @rembautimes8808
    @rembautimes880816 күн бұрын

    Great content, watching this from Malaysia. Well documented steps to help us get started with Alembic 😀

  • @bugbytes3923

    @bugbytes3923

    12 күн бұрын

    Awesome, would love to visit Malaysia! Thanks from Scotland

  • @srirampasagadi1678
    @srirampasagadi1678Күн бұрын

    Thank you for detailed tutorial 👍

  • @misaelramirez7550
    @misaelramirez7550Ай бұрын

    The only video you need :)

  • @bugbytes3923

    @bugbytes3923

    Ай бұрын

    Thanks a lot!

  • @mohitjoshi8818
    @mohitjoshi88184 ай бұрын

    Thanks for this beautiful and easy explanation. I wish you more subscribers. Keep posting videos like these.

  • @bugbytes3923

    @bugbytes3923

    4 ай бұрын

    Thanks a lot, really appreciate the comment! Will do!

  • @srikanthrenatla
    @srikanthrenatla4 ай бұрын

    Thanks for the video. You are a very good teacher. Keep it up, bro.

  • @bugbytes3923

    @bugbytes3923

    4 ай бұрын

    Thanks very much, will do!

  • @alekis1637
    @alekis1637Ай бұрын

    Very good!

  • @bugbytes3923

    @bugbytes3923

    Ай бұрын

    Thanks a lot!

  • @stimpypzo
    @stimpypzoАй бұрын

    Thanks for the brief explanation, the basic was really covered. Maybe add an example of using environment variables to use in the "sqlalchemy.url" parameter or explain the default and server_default use case, but is just too mucho info. Again, thanks!

  • @Jumalungma-ls8rz
    @Jumalungma-ls8rz5 ай бұрын

    Such a clear explanation!

  • @bugbytes3923

    @bugbytes3923

    5 ай бұрын

    Thanks a lot!

  • @nasirolagunju1549
    @nasirolagunju15495 ай бұрын

    Wonderful explanation. I can't thank you enough.

  • @bugbytes3923

    @bugbytes3923

    4 ай бұрын

    Awesome! Thanks a lot for watching!

  • @laurenssandt6044
    @laurenssandt60443 ай бұрын

    Great tutorial works with an instant adaptation to sqlmodel. Thanks

  • @bugbytes3923

    @bugbytes3923

    3 ай бұрын

    Awesome to hear it, thanks!

  • @AmoahDevLabs
    @AmoahDevLabs7 ай бұрын

    Great one. Thanks very much.

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    Thanks a lot!

  • @matin_codes
    @matin_codesАй бұрын

    awesome!

  • @iwswordpress
    @iwswordpress3 ай бұрын

    As ever, excellent video and presentation.

  • @bugbytes3923

    @bugbytes3923

    3 ай бұрын

    Thanks a lot!

  • @user-zm2fm5mr9d
    @user-zm2fm5mr9d3 ай бұрын

    insane video brother, thank you

  • @bugbytes3923

    @bugbytes3923

    3 ай бұрын

    Thanks a lot bro!

  • @altumpax9382
    @altumpax93824 ай бұрын

    Cool stuff, I needed this tbh.

  • @bugbytes3923

    @bugbytes3923

    4 ай бұрын

    Thanks for watching!

  • @user-mj7zz2qf6b
    @user-mj7zz2qf6b4 ай бұрын

    great video super useful and highly recommended 🔥🔥

  • @bugbytes3923

    @bugbytes3923

    4 ай бұрын

    Thanks a lot, appreciate it!

  • @Yaroslav7705
    @Yaroslav770524 күн бұрын

    Bravo ! Thnks

  • @bugbytes3923

    @bugbytes3923

    24 күн бұрын

    Thanks a lot!

  • @infernape716
    @infernape7165 ай бұрын

    great video! looking forward to the alembic + fastapi video

  • @bugbytes3923

    @bugbytes3923

    5 ай бұрын

    Thanks a lot!

  • @rsvijaytiwari
    @rsvijaytiwari3 ай бұрын

    Great Brother!

  • @bugbytes3923

    @bugbytes3923

    3 ай бұрын

    Thanks bro!

  • @streamocu2929
    @streamocu29296 ай бұрын

    thank you father

  • @theintjengineer
    @theintjengineer7 ай бұрын

    The algorithm must be messing up with you. How come you don't have 500k subscribers yet? Anyway. Again, very high-quality content, BugBytes🎉🤯. Thank you very much. Greetings from Germany.

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    Thanks a lot for the kind words! Appreciate it! Greetings from Scotland!

  • @aashayamballi
    @aashayamballi7 ай бұрын

    Can you please create video on advanced topics on Django migrations? Thank you for the quality content!

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    Thanks - will do more migration stuff in Django, yes!

  • @MrznMkhl
    @MrznMkhl5 ай бұрын

    can you please cover foreign keys too?

  • @SaiKrishnaKuchimanchi
    @SaiKrishnaKuchimanchi2 ай бұрын

    in my case the upgrade and downgrade functions are not getting updated. only the database is getting updated. can u tell me how to resolve this ?

  • @diwakardayalan
    @diwakardayalan2 ай бұрын

    If I need to add multiple tables, how does alembic handles it

  • @shahidkhan4942
    @shahidkhan4942Ай бұрын

    can we use this with sqlmodel in fastapi

  • @bugbytes3923

    @bugbytes3923

    Ай бұрын

    Yes I did a follow up on using both: kzread.info/dash/bejne/rIiHz9iOhsXRaLA.htmlsi=eGyvgHpbjg0ihLRK

  • @alexandrodisla6285
    @alexandrodisla62857 ай бұрын

    Beanie and Beanie migration

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    Thanks for the suggestion!

  • @alexandrodisla6285
    @alexandrodisla62857 ай бұрын

    Why a channel named *better stack* is using your content?

  • @bugbytes3923

    @bugbytes3923

    7 ай бұрын

    I'm working with Better Stack to make some more videos, so it's all good! If you wanna see more, feel free to subscribe!