MCPcopy
hub / github.com/django/django / get_select_mask

Method get_select_mask

django/db/models/sql/query.py:877–897  ·  view source on GitHub ↗

Convert the self.deferred_loading data structure to an alternate data structure, describing the field that *will* be loaded. This is used to compute the columns to select from the database and also by the QuerySet class to work out which fields are being initialized

(self)

Source from the content-addressed store, hash-verified

875 return select_mask
876
877 def get_select_mask(self):
878 """
879 Convert the self.deferred_loading data structure to an alternate data
880 structure, describing the field that *will* be loaded. This is used to
881 compute the columns to select from the database and also by the
882 QuerySet class to work out which fields are being initialized on each
883 model. Models that have all their fields included aren't mentioned in
884 the result, only those that have field restrictions in place.
885 """
886 field_names, defer = self.deferred_loading
887 if not field_names:
888 return {}
889 mask = {}
890 for field_name in field_names:
891 part_mask = mask
892 for part in field_name.split(LOOKUP_SEP):
893 part_mask = part_mask.setdefault(part, {})
894 opts = self.get_meta()
895 if defer:
896 return self._get_defer_select_mask(opts, mask)
897 return self._get_only_select_mask(opts, mask)
898
899 def table_alias(self, table_name, create=False, filtered_relation=None):
900 """

Callers 1

get_selectMethod · 0.80

Calls 5

get_metaMethod · 0.95
_get_only_select_maskMethod · 0.95
splitMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected