Opened 7 years ago

Closed 7 years ago

#28454 closed Cleanup/optimization (fixed)

Simplify use of Query.setup_joins() by returning a named tuple

Reported by: Matthew Wilkes Owned by: matthewwilkes
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: orm
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

This is split from review of #24747's PR, specifically

This is getting out of hand, especially considering callers ignoring so many of the return values. Does it make sense to create a type to model these values? At a minimum I think we should consider namedtuple.

No argument here, I got a bit of underscore blindness at times. Think that should be its own PR, so we don't have too much refactoring in with functionality changes?

Yes please

The Query.setup_joins() method currently returns a tuple of many pieces of data. #24747 adds another to that list. As many users of setup_joins() unpacked multiple variables to _ placeholders, it was decided to simplify usage and make it easier to add additional items to the tuple without changing the unpacking.

Change History (2)

comment:1 by Tim Graham, 7 years ago

Component: UncategorizedDatabase layer (models, ORM)
Description: modified (diff)
Summary: Simplify use of setup_joins by returning a named tupleSimplify use of Query.setup_joins() by returning a named tuple
Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 32d1bf2:

Fixed #28454 -- Simplifed use of Query.setup_joins() by returning a named tuple.

Note: See TracTickets for help on using tickets.
Back to Top