MCPcopy
hub / github.com/tortoise/tortoise-orm / ValuesListQuery

Class ValuesListQuery

tortoise/queryset.py:1630–1763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1628
1629
1630class ValuesListQuery(FieldSelectQuery, Generic[SINGLE]):
1631 __slots__ = (
1632 "fields",
1633 "_limit",
1634 "_offset",
1635 "_distinct",
1636 "_orderings",
1637 "_single",
1638 "_raise_does_not_exist",
1639 "_fields_for_select_list",
1640 "_flat",
1641 "_group_bys",
1642 "_force_indexes",
1643 "_use_indexes",
1644 "_fields_to_select_sql",
1645 )
1646
1647 def __init__(
1648 self,
1649 model: type[MODEL],
1650 db: BaseDBAsyncClient,
1651 q_objects: list[Q],
1652 single: bool,
1653 raise_does_not_exist: bool,
1654 fields_for_select_list: tuple[str, ...] | list[str],
1655 limit: int | None,
1656 offset: int | None,
1657 distinct: bool,
1658 orderings: list[tuple[str, str]],
1659 flat: bool,
1660 annotations: dict[str, Any],
1661 custom_filters: dict[str, FilterInfoDict],
1662 group_bys: tuple[str, ...],
1663 force_indexes: set[str],
1664 use_indexes: set[str],
1665 ) -> None:
1666 super().__init__(model, annotations)
1667 if flat and (len(fields_for_select_list) != 1):
1668 raise TypeError("You can flat value_list only if contains one field")
1669
1670 fields_for_select = {str(i): field for i, field in enumerate(fields_for_select_list)}
1671 self.fields = fields_for_select
1672 self._limit = limit
1673 self._offset = offset
1674 self._distinct = distinct
1675 self._orderings = orderings
1676 self._custom_filters = custom_filters
1677 self._q_objects = q_objects
1678 self._single = single
1679 self._raise_does_not_exist = raise_does_not_exist
1680 self._fields_for_select_list = fields_for_select_list
1681 self._flat = flat
1682 self._db = db
1683 self._group_bys = group_bys
1684 self._force_indexes = force_indexes
1685 self._use_indexes = use_indexes
1686 self._fields_to_select_sql = {
1687 *self._fields_for_select_list,

Callers 1

values_listMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…