Hi,
#408 changed the return type for all fetch ops from Mapping to Sequence, because of a change in SQLAlchemy 1.4.
This means Databases doesn't seem to offer any standard way to access the result values by name anymore.
The postgres backend offers a _mapping property and all the other backends are using SQLAlchemy's Row, which means _mapping is also available, but this is not documented as far as I can tell.
In SQLAlchemy the change wasn't intended to remove named access, the returned Row offers the result set as properties instead, like a named tuple, and in SQLAlchemy 2.0 there's a mapping() method on the result.
Could we add a standardized way of accessing the mapping in Databases as well?
Adding the _mapping property to the result set interface would be enough, but maybe there's a better idea.
Another easy way would be to implement __getattr__ on the postgres backend's Record type.
Hi,
#408 changed the return type for all fetch ops from
MappingtoSequence, because of a change in SQLAlchemy 1.4.This means Databases doesn't seem to offer any standard way to access the result values by name anymore.
The postgres backend offers a
_mappingproperty and all the other backends are using SQLAlchemy'sRow, which means_mappingis also available, but this is not documented as far as I can tell.In SQLAlchemy the change wasn't intended to remove named access, the returned Row offers the result set as properties instead, like a named tuple, and in SQLAlchemy 2.0 there's a
mapping()method on the result.Could we add a standardized way of accessing the mapping in Databases as well?
Adding the
_mappingproperty to the result set interface would be enough, but maybe there's a better idea.Another easy way would be to implement
__getattr__on the postgres backend'sRecordtype.