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)
| 1655 | |
| 1656 | @_generative |
| 1657 | def options(self, *args: ExecutableOption) -> Self: |
| 1658 | """Return a new :class:`_query.Query` object, |
| 1659 | applying the given list of |
| 1660 | mapper options. |
| 1661 | |
| 1662 | Most supplied options regard changing how column- and |
| 1663 | relationship-mapped attributes are loaded. |
| 1664 | |
| 1665 | .. seealso:: |
| 1666 | |
| 1667 | :ref:`loading_columns` |
| 1668 | |
| 1669 | :ref:`relationship_loader_options` |
| 1670 | |
| 1671 | """ |
| 1672 | |
| 1673 | opts = tuple(util.flatten_iterator(args)) |
| 1674 | if self._compile_options._current_path: |
| 1675 | # opting for lower method overhead for the checks |
| 1676 | for opt in opts: |
| 1677 | if not opt._is_core and opt._is_legacy_option: # type: ignore |
| 1678 | opt.process_query_conditionally(self) # type: ignore |
| 1679 | else: |
| 1680 | for opt in opts: |
| 1681 | if not opt._is_core and opt._is_legacy_option: # type: ignore |
| 1682 | opt.process_query(self) # type: ignore |
| 1683 | |
| 1684 | self._with_options += opts |
| 1685 | return self |
| 1686 | |
| 1687 | def with_transformation( |
| 1688 | self, fn: Callable[[Query[Any]], Query[Any]] |