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

Method _setup_options

lib/sqlalchemy/orm/strategies.py:1727–1759  ·  view source on GitHub ↗
(
        self,
        context,
        q,
        subq_path,
        rewritten_path,
        orig_query,
        effective_entity,
        loadopt,
    )

Source from the content-addressed store, hash-verified

1725 return q
1726
1727 def _setup_options(
1728 self,
1729 context,
1730 q,
1731 subq_path,
1732 rewritten_path,
1733 orig_query,
1734 effective_entity,
1735 loadopt,
1736 ):
1737 # note that because the subqueryload object
1738 # does not reuse the cached query, instead always making
1739 # use of the current invoked query, while we have two queries
1740 # here (orig and context.query), they are both non-cached
1741 # queries and we can transfer the options as is without
1742 # adjusting for new criteria. Some work on #6881 / #6889
1743 # brought this into question.
1744 new_options = orig_query._with_options
1745
1746 if loadopt and loadopt._extra_criteria:
1747 new_options += (
1748 orm_util.LoaderCriteriaOption(
1749 effective_entity,
1750 loadopt._generate_extra_criteria(context),
1751 ),
1752 )
1753
1754 # propagate loader options etc. to the new query.
1755 # these will fire relative to subq_path.
1756 q = q._with_current_path(rewritten_path)
1757 q = q.options(*new_options)
1758
1759 return q
1760
1761 def _setup_outermost_orderby(self, q):
1762 if self.parent_property.order_by:

Callers 1

Calls 3

_with_current_pathMethod · 0.80
optionsMethod · 0.45

Tested by

no test coverage detected