Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Missing named access to result setΒ #445

@bustbr

Description

@bustbr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions