|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/django-drf-query-fundamentals/
课程评论:没有评论
**课程名称:** Django DRF ORM 查询基础 **课程概述:** 本课程旨在帮助您精通 Django ORM (对象关系映射) 和 Django REST Framework (DRF),从而构建可扩展的、数据库驱动的 API。课程将从数据库设计和查询的基础知识开始,逐步深入到高级筛选、连接和优化,并将其与 DRF 集成,通过 API 暴露您的数据。 **课程内容:** * **模块一:引言** * 课程总览、结构及学习目标。 * **模块二:设置开发环境** * 安装和配置 VSCode、Docker 和 PostgreSQL。 * 在 Docker 化环境中设置 Django + DRF,为实际开发做准备。 * **模块三:使用 Django ORM 定义数据库表** * 学习如何定义模型、关系 (一对多、多对多、一对一) 和约束。 * 处理常见的数据库类型,如字符串、数字和布尔值。 * 实现主键、外键和唯一约束。 * 通过 PostgreSQL 初始化脚本自动化数据库表创建。 * **模块四:插入、更新和删除数据** * 使用 ViewSets 和 Serializers 通过 DRF 插入、更新和删除记录。 * 学习批量操作、嵌套插入和处理关联对象。 * 自动化数据库填充,实现快速项目设置。 * **模块五:高效查询数据库** * 使用 all()、values()、only() 检索记录。 * 通过查询参数和 URL 路径实现动态筛选。 * 处理排序、分页和去重。 * **模块六:高级筛选和查询优化** * 使用 Q 对象进行复杂查询 (AND、OR、NOT)。 * 应用模式匹配、范围筛选和逻辑运算符。 * 通过列表切片和高效筛选技术优化查询。 * **模块七:连接和查询关系** * 使用 Django ORM 执行 INNER JOIN。 * 使用 prefetch_related 和 select_related 进行查询优化。 * 在 ORM 不足时编写原生 SQL 查询。 * **模块八:聚合和分组** * 高效地计算计数、总和和平均值。 * 使用 GROUP BY、HAVING 和字段间比较进行高级分析。 **为何学习本课程?** * 使用 Django DRF 和 PostgreSQL 构建真实的、可扩展的 API。 * 精通 Django ORM,有效地进行数据库操作。 * 优化查询的性能和可扩展性。 * 学习构建 DRF 应用的最佳实践。 **目标学员:** * Django DRF 和 ORM 入门开发者。 * 寻求优化查询性能的后端工程师。 * 任何希望构建高效、可扩展 REST API 的人员。 **学习成果:** 完成本课程后,您将能够自信地设计和查询数据库,并构建生产级的 Django REST API!
This course is designed to help you master Django ORM (Object-Relational Mapping) and Django REST Framework (DRF) to build scalable, database-driven APIs. You'll start from the fundamentals of database design and queries and progress to advanced filtering, joins, and optimizations-all while integrating with DRF to expose your data through APIs.Course OverviewModule 1: IntroductionGet an overview of the course, its structure, and what you'll achieve by the end.Module 2: Setting Up Your Development EnvironmentInstall and configure VSCode, Docker, and PostgreSQL.Set up Django + DRF in a Dockerized environment for real-world development.Module 3: Defining Database Tables with Django ORMLearn how to define models, relationships (One-to-Many, Many-to-Many, One-to-One), and constraints.Work with common data types like strings, numbers, and booleans.Implement primary keys, foreign keys, and unique constraints.Automate database table creation with PostgreSQL initialization scripts.Module 4: Inserting, Updating, and Deleting DataWork with ViewSets and Serializers to insert, update, and delete records via DRF.Learn bulk operations, nested inserts, and handling related objects.Automate database seeding for quick project setup.Module 5: Querying the Database EfficientlyRetrieve records using all(), values(), only().Implement dynamic filtering with query parameters & URL paths.Handle sorting, pagination, and duplicate removal.Module 6: Advanced Filtering & Query OptimizationUse Q Objects for complex queries (AND, OR, NOT).Apply pattern matching, range filters, and logical operators.Optimize queries using list slicing and efficient filtering techniques.Module 7: Joins & Querying RelationshipsPerform INNER JOINs using Django ORM.Use prefetch_related and select_related for query optimization.Write raw SQL queries when ORM isn't enough.Module 8: Aggregation & GroupingCount, sum, and average values efficiently.Use GROUP BY, HAVING, and field-to-field comparisons for advanced analytics.Why Take This Course?Build real-world, scalable APIs using Django DRF & PostgreSQL.Master Django ORM to work with databases effectively. Optimize queries for performance and scalability.Learn best practices for structuring DRF applications.Who is this for?Developers new to Django DRF and ORM.Backend engineers looking to optimize query performance.Anyone who wants to build efficient, scalable REST APIs.By the end of this course, you'll be confident in designing and querying databases while building production-ready Django REST APIs!