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 - Наука
Hey guys, please leave a like. Also tell me how you found this video. More topics. Leave a comment down here.
For topic, I think you should explore microservices with python, aws lambda with python, rabbitmq
@@TheAremoh Sure man. Will definitely create a playlist on this in the future.
Found a course but his sqlalchemy was 1.4 and I'm using 2.0. You are a great help. Documentation is pretty hard
@@seshiria_4290 Really glad it helped
I've found it from your other video about SQLAlchemy from 2 years ago (?) which in turn I've found from google lol
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!
Glad it helped. Thanks for the super chat.
for your select statement at 41:50 why did you use scaler instead of using the execute syntax?
@sma92878 docs.sqlalchemy.org/en/20/orm/session_api.html
Really sorry I wasn’t in position to explain. I’ll probably make a video on this later. Thanks for watching
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.
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!
Thanks for the kind comment. I’m really glad you enjoyed my video
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!
Glad you liked it
Thank you so much for making this video!!! It is so informative, easy to follow along, and easy to understand. Love it!
Thanks for watching
As always creative and wonderful
Very good content, my friend ! Thank you for that !
Thank you too! for watching
Love the videos. Someone shared your link on a discord group and I love what you have here. Keep it up.
Awesome, thank you!
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.
Glad you liked it. Cheers
fire tutorial!! much better than official documentation
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.
Quite Informative! This is exactly what I needed
Thanks for watching. I’m glad you liked the video
This is amazing! I've learnt from your work.
I am really glad my video helped. Thanks for watching.
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.
I am glad you found my video useful.
Thanks for your work.
Nice tutorial from You Jona... Very comprehensive.
Really glad it helped. Thanks for watching
Greta stuff. My students will like your explanations!!
Thanks for sharing. Thanks for watching . I appreciate the feedback
Quarterway through but already learned so much. Thanks a lot 💯
I’m glad my video is helping
thank you for sharing this!!
You're so welcome!
I like the modularization of the code. its so educative. can you do a video with GUI please
I pushed subscribe with a bell, just as you taught in the course :)
Thanks for watching
great, thank you!
Glad it helped
you are the best!!!!!! brazil here
Thanks . Appreciate the support
Clear and Very Good Tutorials. You are helping us to get a better understanding about this topic. God Bless...
Thanks for watching. I appreciate the feedback
FINALLY, someone who actually knows what they are doing
Thank you a lot. You really helped me
Glad I did. Thanks for watching
hello, you've done a nice video. Thanks for that.
Glad it helped! Thanks for watching
Not seeing any fellow Ugandans' likes/comments! Bravo Ssali..sending you love from USA
Thanks for watching
Clear and good explanation
Glad you enjoyed it
thank-you for this video
My pleasure
Great explanation
Glad it helped
great simple explanation
Glad it was helpful! Thanks for watching.
Thank you!!!
Glad you watched
NICE)))
Glad it helped
Thank you
You're welcome
You helped me so much. I had to work with sql orm for the first time and I was so lost😅
Glad it helped
🙌 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?
Yeah sure. I want to come up with a weekly consistent upload schedule.
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 ?
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
@@SsaliJonathan Hi brother, I'm already subscribed and liked, thanks for the useful content.
i just subscribed
Thanks
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.
Create the virtual environment with python -m env
Activate it with source env/bin/activate
To connect to the database, run the database creation file
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?
I need some clarity
I love your videos can you go over schema and metadata ?
I cover this in my previous video
👋👍
Hi great video, I have a question. what extension did you use in your Vscode that told you `File 0% Documented`?
It’s called AI auto docstring generator
@@SsaliJonathan thanks bro ❤️
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
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
this is out the topic. but can you tell me what webcam and setup you using when you creating video like this?
Nothing really much brother. I record with my iPhone XR. I use a software called Droidcam. Then I set it up with OBS
@@SsaliJonathan thanks bro.🥰
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.
Have you imported the models?
@@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.
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?
One using Sqlalchemy? I don’t have one but I may make one in the future. Thanks for watching
Can you plz help me out,how can i map images to the python?
Normally, you would consider using a storage service like Amazon S3 or Firebase cloud storage.
hey can you send the official documentation for this
docs.sqlalchemy.org/en/20/orm/quickstart.html
Why use:
class Base(DeclarativeBase):
pass
When you can use:
Base = declarative_base()
?
The DeclarativeBase class was introduced in SQLAlchemy 2.0. Read about it here please. docs.sqlalchemy.org/en/20/orm/quickstart.html
@@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
could you not get your lighting set up correctly?
Sure I will
Can you give me the files Jonathan?
The link to the source code is in the description
so refreshing to not hear another Indian voice throughout the video! subbed and liked
Thanks for the sub!