У нас вы можете посмотреть бесплатно FastAPI with SQLAlchemy Tutorial или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this video, Jose Haro Peralta explains how to use SQLAlchemy in a FAstAPI application. The code for this tutorial is available in GitHub: https://github.com/abunuwas/fastapi-s.... I'd appreciate if you give it a star! Also feel free to fork out the repo and raise any issues you encounter when working with the code! 0:00 Introduction 0:32 Setting up the environment and installing the dependencies 1:59 Project structure 3:25 Initialising and configuring Alembic 5:30 Implementing the SQLAlchemy User model 8:41 Implementing the SQLAlchemy Task model 11:27 Enhancing the SQLAlchemy models with a custom method 12:43 Creating a migration 14:16 Applying the migration 14:37 Adding users to the database 19:05 Generating JWTs for each user 20:11 Creating the session factory object 21:00 Fixing import statements 21:27 Linking users and tasks in the POST /todo endpoint 24:20 Fixing additional path imports 26:17 Testing the POST /todo endpoint 26:33 Retrieving user-specific tasks through the GET /todo endpoint 29:00 Testing the GET /todo endpoint 29:37 Authorising user access to specific tasks (GET /todo/{todo_id} endpoint) 33:22 Testing the GET /todo/{todo_id} endpoint 35:01 Authorising the PUT /todo/{todo_id} and the DELETE /todo/{todo_id} endpoints 37:12 Testing the PUT /todo/{todo_id} and the DELETE /todo/{todo_id} endpoints 38:30 Testing unauthorised access to a resource 39:42 Wrapping up In this video, we add SQLAlchemy models to the TODO API that we implemented in a previous tutorial using FastAPI. We add a model for tasks so that we can persist tasks in the database, and another model for users so that we can link each task to a user. If you're not familiar with FastAPI and want to understand how the API works, take a look at my "FastAPI tutorial" ( • FastAPI Tutorial ). To manage database migrations, we use Alembic. The video shows how to initialise and configure Alembic to work with our SQLAlchemy models. You'll also learn to create foreign keys between different tables using SQLAlchemy, and to leverage SQLAlchemy's relationships to create easy access between related models. Once the SQLAlchemy models are ready, we use them in the API layer to make sure each task we create is linked to a user, and also to make sure a user can only access tasks that belong to them. By completing this tutorial, you'll learn everything you need to know to create a fully-fledged FastAPI application with JWT authorisation and database models! If you want to learn more about SQLAlchemy and Alembic, check out my tutorial "Setting up Alembic with SQLAlchemy" ( • Setting up Alembic with SQLAlchemy ). If you liked this video, please like it and share it with your network! You can also subscribe to my channel! All this goes a long way to supporting me to continue creating this kind of content. I'm also the author of Microservice APIs with Examples in Python. It's a book that explains how to design and build microservices and APIs in Python. /you can get a copy through this link: http://mng.bz/jy4x. Feel free to use the following code to get a 40% discount: slperalta (reach out to me if you have issues using the code). You can also download two chapters of the book for free from this link: https://www.microapis.io/resources/mi... Please let me know in the comments if you liked this video and whether you found it useful. Let me know also what other kinds of topics you'd like me to address in future videos! If you have any questions, feel free to reach out tot me in: Twitter ( / joseharoperalta ) LinkedIn ( / jose-haro.. ) Or join my Reddit microapis group ( / microapis )