Read Only Tracking Not Disabled (ARCH2054)
هذا المحتوى غير متوفر بلغتك بعد.
Key python.orm.readonly-tracking-not-disabled · Severity info · Category orm
Loading fully hydrated entities for read-only queries wastes memory and identity-map cost. Use a lighter read mode such as .values().
Incorrect
Section titled “Incorrect”names = [u.name for u in User.objects.all()] # full entities hydratedCorrect
Section titled “Correct”names = list(User.objects.values_list("name", flat=True)) # columns onlyFor queries that will not be mutated, use .values() / .values_list() to avoid tracking and full hydration.