MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / first

Method first

lib/sqlalchemy/engine/result.py:1693–1704  ·  view source on GitHub ↗

Fetch the first object or ``None`` if no object is present. Equivalent to :meth:`_engine.Result.first` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned.

(self)

Source from the content-addressed store, hash-verified

1691 return self._next_impl()
1692
1693 def first(self) -> Optional[RowMapping]:
1694 """Fetch the first object or ``None`` if no object is present.
1695
1696 Equivalent to :meth:`_engine.Result.first` except that
1697 :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
1698 objects, are returned.
1699
1700
1701 """
1702 return self._only_one_row(
1703 raise_for_second_row=False, raise_for_none=False, scalar=False
1704 )
1705
1706 def one_or_none(self) -> Optional[RowMapping]:
1707 """Return at most one object or raise an exception.

Callers

nothing calls this directly

Calls 1

_only_one_rowMethod · 0.80

Tested by

no test coverage detected