SQLAlchemy 2.0 ORM Crash Course - Manage Relational Databases with Python (SQLAlchemy 2.0)

Поделиться
HTML-код
  • Опубликовано: 26 июн 2024
  • This video talks about the SLQLAlchemy ORM. In this video, we look into the core concepts of SQLAlchemy ORM and explore its robust features, offering you a step-by-step guide to working with databases seamlessly. We walk through the fundamentals, covering topics such as table creation, schema design, querying, and data manipulation.
    SOURCE CODE:
    github.com/jod35/SQLAlchemy-2...
    #python #python3 #sqlalchemy
    PLEASE BUY ME A COFFEE:
    www.buymeacoffee.com/jod35
    SUBSCRIBE TO MY CHANNEL:
    / @ssalijonathan
    TIMESTAMPS:
    (00:00) Introduction
    (1:15) Connecting to the database
    (6:35) Create Database models
    (24:37) Create database tables
    (28:38) Create and persist objects
    (37:45) Select statements
    (42:34) Using sessions to select
    (50:07) selects with join
    (56:31) Update records
    (59:18) Delete records
    (1:01:18) Conclusion
  • НаукаНаука

Комментарии • 120

  • @SsaliJonathan
    @SsaliJonathan  Год назад +20

    Hey guys, please leave a like. Also tell me how you found this video. More topics. Leave a comment down here.

    • @TheAremoh
      @TheAremoh Год назад +1

      For topic, I think you should explore microservices with python, aws lambda with python, rabbitmq

    • @SsaliJonathan
      @SsaliJonathan  Год назад +2

      @@TheAremoh Sure man. Will definitely create a playlist on this in the future.

    • @seshiria_4290
      @seshiria_4290 11 месяцев назад +2

      Found a course but his sqlalchemy was 1.4 and I'm using 2.0. You are a great help. Documentation is pretty hard

    • @SsaliJonathan
      @SsaliJonathan  10 месяцев назад

      @@seshiria_4290 Really glad it helped

    • @DS-bz4mz
      @DS-bz4mz 10 месяцев назад

      I've found it from your other video about SQLAlchemy from 2 years ago (?) which in turn I've found from google lol

  • @sma92878
    @sma92878 9 месяцев назад +40

    This video has saved me HOURS of time, the documentation on the sqlalchemy website is no where near as clear as this video. Keep up the good work!

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад +1

      Glad it helped. Thanks for the super chat.

    • @sma92878
      @sma92878 9 месяцев назад

      for your select statement at 41:50 why did you use scaler instead of using the execute syntax?

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад +2

      @sma92878 docs.sqlalchemy.org/en/20/orm/session_api.html

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад +1

      Really sorry I wasn’t in position to explain. I’ll probably make a video on this later. Thanks for watching

  • @aitools24
    @aitools24 8 месяцев назад +12

    00:10 SQLAlchemy ORM allows us to model and interact with relational databases using Python
    02:34 Create a connection object to connect to a database using SQLAlchemy.
    07:10 Create a base class for database models using SQLAlchemy ORM
    09:37 To map each database table attribute to a class, we need to use the mapped class
    14:09 Defining user ID as a foreign key and comment text as a mapped string.
    16:28 Create relationships in SQLAlchemy to easily access user-related data.
    20:53 Defining relationships between users and comments in SQLAlchemy 2.0 ORM
    23:02 Define database models to represent objects and their properties
    27:18 Created database tables and checked if the information provided is valid.
    29:27 Creating objects using an ORM to persist data in a database
    33:42 Using SQLAlchemy's session class to insert model objects into the database.
    35:45 Persisting data to the database using SQLAlchemy ORM.
    39:51 Querying for usernames and checking against a list of attributes
    41:59 Printing the users from the database using SQLAlchemy ORM
    46:13 Selecting a user with a specific username using SQLAlchemy ORM.
    48:15 Using query.filter_by() allows us to select specific users from the database.
    52:28 Accessing a specific comment with related user using SQLAlchemy ORM.
    54:31 Selecting data from multiple tables using SQLAlchemy
    58:44 Updating and deleting data using SQLAlchemy
    1:00:50 SQLAlchemy helps in managing relational databases with Python.
    Crafted by Merlin AI.

  • @makarisilver
    @makarisilver 10 месяцев назад +8

    Highly underrated channel. Clear and good explanation that makes it easy to understand. This video helped me a lot to get a better understanding of SQLAlchemy.
    Thank you, Sir!

    • @SsaliJonathan
      @SsaliJonathan  10 месяцев назад +1

      Thanks for the kind comment. I’m really glad you enjoyed my video

  • @peculiar-coding-endeavours
    @peculiar-coding-endeavours Год назад +3

    Mate, great series! Got yourself a fat old like for that. You saved me a ton of time going through the SQLAlchemy docs. Keep it coming!

  • @user-wk2nd5ii8s
    @user-wk2nd5ii8s Год назад +2

    Thank you so much for making this video!!! It is so informative, easy to follow along, and easy to understand. Love it!

  • @shamsssherien1216
    @shamsssherien1216 Год назад

    As always creative and wonderful

  • @nathan210594
    @nathan210594 5 месяцев назад

    Very good content, my friend ! Thank you for that !

  • @juliusokwe9524
    @juliusokwe9524 7 месяцев назад

    Love the videos. Someone shared your link on a discord group and I love what you have here. Keep it up.

  • @jeevam7110
    @jeevam7110 10 месяцев назад

    Hi Jonathan, the videos that you made for sqlalchemy ORM and Core are awsome and they are very light weight, and also easy to understand. I had watched your video first but I could not understand. Later I gone through sqlalchemy documentation, then came back to your videos. They were easy to understand. Thanks brother.

  • @olivergray8235
    @olivergray8235 2 месяца назад

    fire tutorial!! much better than official documentation

  • @nobloat5702
    @nobloat5702 3 месяца назад

    Thank you for the great content!
    I just want to mention that when using Mapped, nullable=False is set by default so we don't need to specify it like in the old notation. They added this to make things more succinct and Pythonic.

  • @mainasdigitaldomain
    @mainasdigitaldomain 6 месяцев назад

    Quite Informative! This is exactly what I needed

    • @SsaliJonathan
      @SsaliJonathan  6 месяцев назад

      Thanks for watching. I’m glad you liked the video

  • @user-bh1uj9on9v
    @user-bh1uj9on9v 9 месяцев назад

    This is amazing! I've learnt from your work.

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад

      I am really glad my video helped. Thanks for watching.

  • @RedIron767
    @RedIron767 2 месяца назад

    Top-notch video in every way. Nicely paced, good examples, very well narrated. Thanks for putting in this grade-A effort. I suspect you’ve saved people thousands of hours with this.

    • @SsaliJonathan
      @SsaliJonathan  2 месяца назад

      I am glad you found my video useful.

  • @MrDarthBudda
    @MrDarthBudda 8 месяцев назад +1

    Thanks for your work.

  • @ScorpusMugnes
    @ScorpusMugnes Месяц назад

    Nice tutorial from You Jona... Very comprehensive.

    • @SsaliJonathan
      @SsaliJonathan  Месяц назад

      Really glad it helped. Thanks for watching

  • @rainertelesko9894
    @rainertelesko9894 4 месяца назад

    Greta stuff. My students will like your explanations!!

    • @SsaliJonathan
      @SsaliJonathan  4 месяца назад

      Thanks for sharing. Thanks for watching . I appreciate the feedback

  • @ongayijohnian8787
    @ongayijohnian8787 2 месяца назад

    Quarterway through but already learned so much. Thanks a lot 💯

  • @leli5843
    @leli5843 Год назад

    thank you for sharing this!!

  • @andrewmutisya4486
    @andrewmutisya4486 14 дней назад

    I like the modularization of the code. its so educative. can you do a video with GUI please

  • @robertmazurowski5974
    @robertmazurowski5974 10 месяцев назад

    I pushed subscribe with a bell, just as you taught in the course :)

  • @MasterDomai
    @MasterDomai Год назад

    great, thank you!

  • @vitorsilva-or1dj
    @vitorsilva-or1dj Год назад

    you are the best!!!!!! brazil here

  • @joven2454
    @joven2454 9 месяцев назад

    Clear and Very Good Tutorials. You are helping us to get a better understanding about this topic. God Bless...

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад

      Thanks for watching. I appreciate the feedback

  • @jesuschris9543
    @jesuschris9543 3 месяца назад

    FINALLY, someone who actually knows what they are doing

  • @NoName-lu7jf
    @NoName-lu7jf Месяц назад

    Thank you a lot. You really helped me

  • @niampahamidou8931
    @niampahamidou8931 6 месяцев назад

    hello, you've done a nice video. Thanks for that.

    • @SsaliJonathan
      @SsaliJonathan  6 месяцев назад

      Glad it helped! Thanks for watching

  • @muhangieudis4925
    @muhangieudis4925 4 месяца назад

    Not seeing any fellow Ugandans' likes/comments! Bravo Ssali..sending you love from USA

  • @nazaireabakou63
    @nazaireabakou63 8 месяцев назад

    Clear and good explanation

  • @user-ex8cs4mz2p
    @user-ex8cs4mz2p Год назад

    thank-you for this video

  • @TheAremoh
    @TheAremoh Год назад

    Great explanation

  • @sanketwagh7768
    @sanketwagh7768 9 месяцев назад

    great simple explanation

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад

      Glad it was helpful! Thanks for watching.

  • @funniyatoons
    @funniyatoons 10 месяцев назад

    Thank you!!!

  • @Developer_python_
    @Developer_python_ Год назад

    NICE)))

  • @randomresearch8494
    @randomresearch8494 6 месяцев назад

    Thank you

  • @oktopussy9628
    @oktopussy9628 Год назад +1

    You helped me so much. I had to work with sql orm for the first time and I was so lost😅

  • @humbletitan8374
    @humbletitan8374 Год назад

    🙌 Looking forward to what you choose for next week. Do you have a general idea what direction you'd like to take with the videos?

    • @SsaliJonathan
      @SsaliJonathan  Год назад +1

      Yeah sure. I want to come up with a weekly consistent upload schedule.

  • @preuttipuawade9402
    @preuttipuawade9402 7 месяцев назад

    Great introduction it helps to get an understanding of this ORM concept through SQLAlchemy. Do you have another video to teach about more complex select statement that involve common table expression or sub-query, joining of multiple tables or do some windows function function using SQLAlchemy ?

    • @SsaliJonathan
      @SsaliJonathan  7 месяцев назад +1

      Glad this video helped. I’m looking forward to releasing a video on this specific topic. Please subscribe to watch it when I upload . Thanks

    • @preuttipuawade9402
      @preuttipuawade9402 7 месяцев назад

      @@SsaliJonathan Hi brother, I'm already subscribed and liked, thanks for the useful content.

  • @zwivhuyakhoza265
    @zwivhuyakhoza265 7 месяцев назад

    i just subscribed

  • @j.w.1175
    @j.w.1175 Год назад +1

    Great presentation. Can you give info on setting up the DB and Visual studio code env? I plan to reproduce what you show during this weekend.

    • @SsaliJonathan
      @SsaliJonathan  Год назад

      Create the virtual environment with python -m env
      Activate it with source env/bin/activate

    • @SsaliJonathan
      @SsaliJonathan  Год назад

      To connect to the database, run the database creation file

  • @MukundMohanan
    @MukundMohanan 11 месяцев назад

    Hi @SsaliJonathan
    Great crash course!
    I would like to know if its possible to update the table it self and SQLAlchemy can update the table columns?

  • @Ghost-id3tu
    @Ghost-id3tu Год назад

    I love your videos can you go over schema and metadata ?

  • @atillaalagoz4100
    @atillaalagoz4100 3 месяца назад

    👋👍

  • @alisadeghi108
    @alisadeghi108 8 месяцев назад

    Hi great video, I have a question. what extension did you use in your Vscode that told you `File 0% Documented`?

    • @SsaliJonathan
      @SsaliJonathan  8 месяцев назад +1

      It’s called AI auto docstring generator

    • @alisadeghi108
      @alisadeghi108 8 месяцев назад

      @@SsaliJonathan thanks bro ❤️

  • @mikegraziano5142
    @mikegraziano5142 10 месяцев назад

    Hi Ssali. Thanks for the great tutorials as I try to absorb as much knowledge on SQLAlchemy as possible. I came from a Java background where I used MyBatis as my ORM and loved it. On that note, I have a question. I want to issue raw SQL and have SQLAlchemy's ORM capability populate a collection of objects. That may not be pythonic, but I'd like to know how to do it with declarative mapping. Is it possible and, if so, I'd love to see an example.
    Thx & rgds
    mjg

    • @SsaliJonathan
      @SsaliJonathan  10 месяцев назад

      The Sqlalchemy core ca help you write python statements to query your database as though you were using sql. Check out my video on it. ruclips.net/video/CfZGWH_vNO0/видео.html

  • @deliotablang823
    @deliotablang823 10 месяцев назад

    this is out the topic. but can you tell me what webcam and setup you using when you creating video like this?

    • @SsaliJonathan
      @SsaliJonathan  10 месяцев назад +1

      Nothing really much brother. I record with my iPhone XR. I use a software called Droidcam. Then I set it up with OBS

    • @deliotablang823
      @deliotablang823 10 месяцев назад

      @@SsaliJonathan thanks bro.🥰

  • @raauger
    @raauger Месяц назад

    So far, I think that the tutorial is first class. When I run the code at 27:30 I do not see the table structure SQL. Is this a setting, or am I missing something? I am running Fedora Linux.

    • @SsaliJonathan
      @SsaliJonathan  Месяц назад

      Have you imported the models?

    • @raauger
      @raauger Месяц назад

      @@SsaliJonathan Thank you. I figured it out. It doesn't print out the tables if the database already exists, and the tables have already been created.

  • @SC-hp5dn
    @SC-hp5dn 11 месяцев назад

    This is a very good video. However, I was looking for a tutorial on how to access data from an existing oracle database, one I didn't create and have read only access. If you have a such a video could u please share the link?

    • @SsaliJonathan
      @SsaliJonathan  11 месяцев назад +1

      One using Sqlalchemy? I don’t have one but I may make one in the future. Thanks for watching

  • @munagalasairaghava3029
    @munagalasairaghava3029 9 месяцев назад

    Can you plz help me out,how can i map images to the python?

    • @SsaliJonathan
      @SsaliJonathan  9 месяцев назад

      Normally, you would consider using a storage service like Amazon S3 or Firebase cloud storage.

  • @VishalSingh-er2bl
    @VishalSingh-er2bl 3 месяца назад

    hey can you send the official documentation for this

    • @SsaliJonathan
      @SsaliJonathan  3 месяца назад

      docs.sqlalchemy.org/en/20/orm/quickstart.html

  • @PedigreeGuitars
    @PedigreeGuitars 3 месяца назад

    Why use:
    class Base(DeclarativeBase):
    pass
    When you can use:
    Base = declarative_base()
    ?

    • @SsaliJonathan
      @SsaliJonathan  3 месяца назад +1

      The DeclarativeBase class was introduced in SQLAlchemy 2.0. Read about it here please. docs.sqlalchemy.org/en/20/orm/quickstart.html

    • @PedigreeGuitars
      @PedigreeGuitars 3 месяца назад

      @@SsaliJonathan I did read it, and tested the old way as well, and it did work. Just wanted to understand the change. But I agree that in doubt let’s follow the SQLAlchemy example tutorial. Thanks for taking the time to respond. Good stuff you have done here. Congrats

  • @BijouBakson
    @BijouBakson 8 месяцев назад

    could you not get your lighting set up correctly?

  • @pranavakailash8751
    @pranavakailash8751 11 месяцев назад

    Can you give me the files Jonathan?

    • @SsaliJonathan
      @SsaliJonathan  11 месяцев назад

      The link to the source code is in the description

  • @user-ho7qy4tx6v
    @user-ho7qy4tx6v Год назад +4

    so refreshing to not hear another Indian voice throughout the video! subbed and liked