Home > Backend Development > Python Tutorial > How to use QuerySets? Summary of QuerySets instance usage

How to use QuerySets? Summary of QuerySets instance usage

伊谢尔伦
Release: 2017-06-11 13:01:43
Original
2719 people have browsed it

Object-relational mapping (ORM) makes interacting with SQL databases simpler, but it is also considered to be inefficient and slower than original SQL. To use an ORM effectively means understanding how it queries the database. In this article I will focus on how to effectively use the Django ORM system to access medium to large data sets. Django’s queryset is lazy Django's queryset corresponds to several records (rows) in the database, filtered through optional queries. For example, the following code will get all the people named ‘Dave’ in the database: person_set = Person.objects.filter(first_name="Dave") The above code does not run any database queries. You can use person_set, add some filter conditions to it, or pass it to a function, and these operations will not be sent to the database. This is right because database queries are a significant impact on web application performance

1. Using Django’s QuerySets effectively

How to use QuerySets? Summary of QuerySets instance usage

Introduction: Using Django’s QuerySets effectively

##2. Introduction to QuerySets in Python’s Django framework

Introduction: This article mainly introduces QuerySets in Python's Django framework. QuerySet is a built-in object list in Django. It is often used for database operations. Friends in need can refer to it.

3. Detailed explanation of the use of Manager method in Python’s Django framework

Introduction: This article mainly introduces The use of Manager methods in Python's Django framework includes operations such as modifying the initial Manager QuerySets and adding additional Manager methods. Friends in need can refer to

4. Using Python ORM in the Django framework to establish a query API

Introduction: This article mainly introduces the use of the ORM in the Django framework of Python to establish a query API, focusing on Managers and QuerySets. For introduction, friends in need can refer to

[Related Q&A recommendations]:

python - Django's queryset uses the reduce method to merge problems.

The above is the detailed content of How to use QuerySets? Summary of QuerySets instance usage. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template