MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / options

Method options

lib/sqlalchemy/orm/query.py:1636–1664  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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]]

Callers 15

_add_lazyload_optionsMethod · 0.45
_setup_orm_returningMethod · 0.45
load_on_pk_identityFunction · 0.45
do_loadFunction · 0.45
_get_implMethod · 0.45
_setup_optionsMethod · 0.45
_load_for_pathMethod · 0.45
_list_dbsFunction · 0.45
_engine_uriFunction · 0.45
goMethod · 0.45

Calls 2

process_queryMethod · 0.80