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

Method undefer

lib/sqlalchemy/orm/strategy_options.py:642–681  ·  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

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