تخطَّ إلى المحتوى

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().

names = [u.name for u in User.objects.all()] # full entities hydrated
names = list(User.objects.values_list("name", flat=True)) # columns only

For queries that will not be mutated, use .values() / .values_list() to avoid tracking and full hydration.