| May | JUN | Jul |
| 15 | ||
| 2021 | 2022 | 2023 |
COLLECTED BY
Collection: Save Page Now Outlinks
The Django ORM is an implementation of the object-relational mapping (ORM) concept. Learn more in the data chapter or view all topics.
ForeignKey field relationships, handling IDs and many other
edge cases that come up when frequently working with Django's ORM.
Merging Django ORM with SQLAlchemy for Easier Data Analysis
provides rationale for using the SQLAlchemy ORM
instead of Django's default ORM in some situations.
Working with huge data sets in Django
explains how to slice the data you retrieve by query into pages and then
use prefetch_related on a subset of the data rather than your whole
data set.
Solving performance problems in the Django ORM
gives a slew of great code snippets to use with django.db.connection so
you can discover issues such as unexpected extra queries and problematic
key relationships.
Full-text search in Django with PostgreSQL
is a very detailed example that shows how to work specifically with
a PostgreSQL backend.
Django Anti-Patterns: Signals
explains why you should avoid using Django ORM's
signals feature
in your applications if you want to make them easier to maintain.
Django ORM optimization story on selecting the least possible
goes through one developer's Django ORM code refactoring to optimize the
performance and results of a single query.
Fixing your Django async job - database integration
is a great article on how to properly integrate the
RQ task queue with a Django backend.
Many-to-Many field needs
to be converted to a standard ForeignKey column while retaining all
of the data.
Double-checked locking with Django ORM
shows how you can implement a double-checking locking pattern in the
Django ORM with PostgreSQL, which is useful
when you want to prevent multiple processes from accessing the same
data at the same time.
Using Django Check Constraints for the Sum of Percentage Fields
shows how you can combine several PositiveIntegerField model
fields with a checking constraint and a web form that ensures
all of the fields sum up to a precise amount, such as 100%.
Learn Django ORM - Query and Filters
is a video tutorials series that gives an overview of the ORM's
querying and filtering capabilities.