class Row(BaseRow, collections_abc.Sequence):
Known subclasses: sqlalchemy.engine.row.LegacyRow
Represent a single result row.
The .Row
object represents a row of a database result. It is
typically associated in the 1.x series of SQLAlchemy with the
_engine.CursorResult
object, however is also used by the ORM for
tuple-like results as of SQLAlchemy 1.4.
The .Row
object seeks to act as much like a Python named
tuple as possible. For mapping (i.e. dictionary) behavior on a row,
such as testing for containment of keys, refer to the .Row._mapping
attribute.
See Also
:ref:`coretutorial_selecting` - includes examples of selecting rows from SELECT statements.
.LegacyRow
- Compatibility interface introduced in SQLAlchemy
1.4.
.Row
. .Row
is no longer a
"proxy" object in that it contains the final form of data within it,
and now acts mostly like a named tuple. Mapping-like functionality is
moved to the .Row._mapping
attribute, but will remain available
in SQLAlchemy 1.x series via the .LegacyRow
class that is used
by _engine.LegacyCursorResult
.
See :ref:`change_4710_core` for background
on this change.Method | __contains__ |
Undocumented |
Method | __delattr__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __ge__ |
Undocumented |
Method | __getstate__ |
Undocumented |
Method | __gt__ |
Undocumented |
Method | __le__ |
Undocumented |
Method | __lt__ |
Undocumented |
Method | __ne__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setattr__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | _asdict |
Return a new dict which maps field names to their corresponding values. |
Method | _op |
Undocumented |
Method | _replace |
Undocumented |
Method | _special_name_accessor |
Handle ambiguous names such as "count" and "index" |
Method | keys |
Return the list of keys as strings represented by this .Row . |
Class Variable | __slots__ |
Undocumented |
Class Variable | count |
Undocumented |
Class Variable | index |
Undocumented |
Property | _field_defaults |
Undocumented |
Property | _fields |
Return a tuple of string keys as represented by this .Row . |
Property | _mapping |
Return a .RowMapping for this .Row . |
Inherited from BaseRow
:
Method | __getattr__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Row objects are constructed by CursorResult objects. |
Method | __iter__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | __reduce__ |
Undocumented |
Method | _filter_on_values |
Undocumented |
Method | _get_by_int_impl |
Undocumented |
Method | _get_by_key_impl |
Undocumented |
Method | _get_by_key_impl_mapping |
Undocumented |
Method | _values_impl |
Undocumented |
Return a new dict which maps field names to their corresponding values.
This method is analogous to the Python named tuple ._asdict()
method, and works by applying the dict() constructor to the
.Row._mapping
attribute.
See Also
.Row._mapping
Return the list of keys as strings represented by this
.Row
.
The keys can represent the labels of the columns returned by a core statement or the names of the orm classes returned by an orm execution.
This method is analogous to the Python dictionary .keys() method, except that it returns a list, not an iterator.
See Also
.Row._fields
.Row._mapping
tuple
=
sqlalchemy.engine.row.BaseRow.__slots__
sqlalchemy.engine.row.LegacyRow
Undocumented
Return a tuple of string keys as represented by this
.Row
.
The keys can represent the labels of the columns returned by a core statement or the names of the orm classes returned by an orm execution.
This attribute is analogous to the Python named tuple ._fields attribute.
See Also
.Row._mapping
Return a .RowMapping
for this .Row
.
This object provides a consistent Python mapping (i.e. dictionary)
interface for the data contained within the row. The .Row
by itself behaves like a named tuple, however in the 1.4 series of
SQLAlchemy, the .LegacyRow
class is still used by Core which
continues to have mapping-like behaviors against the row object
itself.
See Also
.Row._fields