MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / from_statement

Method from_statement

lib/sqlalchemy/orm/query.py:2772–2793  ·  view source on GitHub ↗

Execute the given SELECT statement and return results. This method bypasses all internal statement compilation, and the statement is executed without modification. The statement is typically either a :func:`_expression.text` or :func:`_expression.select` construct,

(self, statement: roles.SelectStatementRole)

Source from the content-addressed store, hash-verified

2770 @_generative
2771 @_assertions(_no_clauseelement_condition)
2772 def from_statement(self, statement: roles.SelectStatementRole) -> Self:
2773 """Execute the given SELECT statement and return results.
2774
2775 This method bypasses all internal statement compilation, and the
2776 statement is executed without modification.
2777
2778 The statement is typically either a :func:`_expression.text`
2779 or :func:`_expression.select` construct, and should return the set
2780 of columns
2781 appropriate to the entity class represented by this
2782 :class:`_query.Query`.
2783
2784 .. seealso::
2785
2786 :meth:`_sql.Select.from_statement` - v2 comparable method.
2787
2788 """
2789 _statement = coercions.expect(
2790 roles.SelectStatementRole, statement, apply_propagate_attrs=self
2791 )
2792 self._statement = _statement
2793 return self
2794
2795 def first(self) -> Optional[_T]:
2796 """Return the first result of this ``Query`` or

Calls

no outgoing calls