MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / undefer

Method undefer

lib/sqlalchemy/orm/strategy_options.py:648–687  ·  view source on GitHub ↗

r"""Indicate that the given column-oriented attribute should be undeferred, e.g. specified within the SELECT statement of the entity as a whole. The column being undeferred is typically set up on the mapping as a :func:`.deferred` attribute. This function is

(self, key: _AttrType)

Source from the content-addressed store, hash-verified

646 )
647
648 def undefer(self, key: _AttrType) -> Self:
649 r"""Indicate that the given column-oriented attribute should be
650 undeferred, e.g. specified within the SELECT statement of the entity
651 as a whole.
652
653 The column being undeferred is typically set up on the mapping as a
654 :func:`.deferred` attribute.
655
656 This function is part of the :class:`_orm.Load` interface and supports
657 both method-chained and standalone operation.
658
659 Examples::
660
661 # undefer two columns
662 session.query(MyClass).options(
663 undefer(MyClass.col1), undefer(MyClass.col2)
664 )
665
666 # undefer all columns specific to a single class using Load + *
667 session.query(MyClass, MyOtherClass).options(Load(MyClass).undefer("*"))
668
669 # undefer a column on a related object
670 select(MyClass).options(defaultload(MyClass.items).undefer(MyClass.text))
671
672 :param key: Attribute to be undeferred.
673
674 .. seealso::
675
676 :ref:`orm_queryguide_column_deferral` - in the
677 :ref:`queryguide_toplevel`
678
679 :func:`_orm.defer`
680
681 :func:`_orm.undefer_group`
682
683 """ # noqa: E501
684 return self._set_column_strategy(
685 _expand_column_strategy_attrs((key,)),
686 {"deferred": False, "instrument": True},
687 )
688
689 def undefer_group(self, name: str) -> Self:
690 """Indicate that columns within the given deferred group name should be

Callers 14

load_options_okFunction · 0.80
load_options_errorFunction · 0.80
goMethod · 0.80
goMethod · 0.80
test_undefer_starMethod · 0.80
test_deep_optionsMethod · 0.80
test_join_with_clearMethod · 0.80

Calls 2

_set_column_strategyMethod · 0.95

Tested by 12

goMethod · 0.64
goMethod · 0.64
test_undefer_starMethod · 0.64
test_deep_optionsMethod · 0.64
test_join_with_clearMethod · 0.64
test_join_no_clearMethod · 0.64
goMethod · 0.64