Opened 3 years ago

Closed 3 years ago

#33214 closed Cleanup/optimization (fixed)

Base DatabaseOperations missing format_for_duration_arithmetic() stub

Reported by: Tim Graham Owned by: Manaia Junior
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When implementing a new database backend, I see the error "AttributeError: 'DatabaseOperations' object has no attribute 'format_for_duration_arithmetic'" rather than getting a message that the method must be implemented.

The method was introduced in 57554442fe3e209c135e15dda4ea45123e579e58.

Change History (5)

comment:1 by Mariusz Felisiak, 3 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Manaia Junior, 3 years ago

Owner: changed from nobody to Manaia Junior
Status: newassigned

comment:3 by Mariusz Felisiak, 3 years ago

For this ticket, we need to add a stub method format_for_duration_arithmetic(self, sql) to the BaseDatabaseOperations that would raise NotImplementedError e.g.

raise NotImplementedError('subclasses of BaseDatabaseOperations may require a format_for_duration_arithmetic() method.')

Test for such methods are in tests/backends/base/test_operations.py.

comment:4 by Mariusz Felisiak, 3 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 551c997:

Fixed #33214 -- Added BaseDatabaseOperations.format_for_duration_arithmetic() stub method.

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