Return a new :class:`_query.Query` object, applying the given list of mapper options. Most supplied options regard changing how column- and relationship-mapped attributes are loaded. .. seealso:: :ref:`loading_columns` :ref:`relatio
(self, *args: ExecutableOption)
| 1634 | |
| 1635 | @_generative |
| 1636 | def options(self, *args: ExecutableOption) -> Self: |
| 1637 | """Return a new :class:`_query.Query` object, |
| 1638 | applying the given list of |
| 1639 | mapper options. |
| 1640 | |
| 1641 | Most supplied options regard changing how column- and |
| 1642 | relationship-mapped attributes are loaded. |
| 1643 | |
| 1644 | .. seealso:: |
| 1645 | |
| 1646 | :ref:`loading_columns` |
| 1647 | |
| 1648 | :ref:`relationship_loader_options` |
| 1649 | |
| 1650 | """ |
| 1651 | |
| 1652 | opts = tuple(util.flatten_iterator(args)) |
| 1653 | if self._compile_options._current_path: |
| 1654 | # opting for lower method overhead for the checks |
| 1655 | for opt in opts: |
| 1656 | if not opt._is_core and opt._is_legacy_option: # type: ignore |
| 1657 | opt.process_query_conditionally(self) # type: ignore |
| 1658 | else: |
| 1659 | for opt in opts: |
| 1660 | if not opt._is_core and opt._is_legacy_option: # type: ignore |
| 1661 | opt.process_query(self) # type: ignore |
| 1662 | |
| 1663 | self._with_options += opts |
| 1664 | return self |
| 1665 | |
| 1666 | def with_transformation( |
| 1667 | self, fn: Callable[[Query[Any]], Query[Any]] |