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

Method from_statement

lib/sqlalchemy/orm/query.py:2715–2736  ·  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: ExecutableReturnsRows)

Source from the content-addressed store, hash-verified

2713 @_generative
2714 @_assertions(_no_clauseelement_condition)
2715 def from_statement(self, statement: ExecutableReturnsRows) -> Self:
2716 """Execute the given SELECT statement and return results.
2717
2718 This method bypasses all internal statement compilation, and the
2719 statement is executed without modification.
2720
2721 The statement is typically either a :func:`_expression.text`
2722 or :func:`_expression.select` construct, and should return the set
2723 of columns
2724 appropriate to the entity class represented by this
2725 :class:`_query.Query`.
2726
2727 .. seealso::
2728
2729 :meth:`_sql.Select.from_statement` - v2 comparable method.
2730
2731 """
2732 statement = coercions.expect(
2733 roles.SelectStatementRole, statement, apply_propagate_attrs=self
2734 )
2735 self._statement = statement
2736 return self
2737
2738 def first(self) -> Optional[_T]:
2739 """Return the first result of this ``Query`` or

Calls

no outgoing calls