MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _setup_options

Method _setup_options

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

_with_current_pathMethod · 0.80
optionsMethod · 0.45

Tested by

no test coverage detected