Opened 3 years ago

Closed 2 years ago

#22603 closed Cleanup/optimization (fixed)

Reorganize code in django.db.backends

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

Description

Currently, database backends are split in modules inconsistently. For example:

  • in the base implementation, most classes are defined in init.py; in actual backends, most classes are in base.py;
  • in the base implementation, BaseDatabaseCreation and BaseDatabaseSchemaEditor have their own modules while other classes are defined in init.py;
  • the postgresql backend has an operations.py, other backends don't.

It would be easier to make cross-backend changes if the code was organized consistently.

Considering the size of the classes involved, I think we should put each class it its own module.

Change History (13)

comment:1 Changed 3 years ago by Anssi Kääriäinen

Triage Stage: UnreviewedAccepted

comment:2 Changed 3 years ago by Greg Chapple

Owner: changed from nobody to Greg Chapple
Status: newassigned

comment:3 Changed 3 years ago by Tim Graham

We should do this late in the 1.8 release cycle when there is less of a chance we'll need to backport bug fixes to 1.7.x as reorganizing a lot of code like this will make backporting more painful.

comment:4 Changed 3 years ago by Greg Chapple

That sounds sensible. I'll put it on hold until closer to the release date. Is the timeline for 1.8 online anywhere? A quick search didn't reveal it.

comment:5 Changed 3 years ago by Tim Graham

No, we're at least a month behind on the 1.7 release, so that needs to be finished first.

comment:6 Changed 2 years ago by Tim Graham

Keywords: 1.8-alpha added

I'm tagging this ticket 1.8-alpha so we can try to make this change close to that date (currently scheduled for January 12) before we fork stable/1.8.x.

comment:7 Changed 2 years ago by Berker Peksag

gchp, are you planning to work on this? I can review your patch or take a look at this before 1.8 alpha.

comment:8 Changed 2 years ago by Greg Chapple

Hey berkerpeksag,
I'm not sure if I'll get time, I don't want to say I will in case I don't. Feel free to assign it to yourself if you like!
Cheers

comment:9 Changed 2 years ago by Tim Graham

There are still a couple large patches that touch these classes that may make it into 1.8 (in particular, PR 3669), so let's hold off a bit longer on this -- I'm thinking after the "feature freeze" on Monday, but before we cut the branch and issue an alpha release.

comment:10 Changed 2 years ago by Tim Graham

Owner: changed from Greg Chapple to Tim Graham

comment:11 Changed 2 years ago by Tim Graham

Has patch: set

comment:12 Changed 2 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

Considering this is essentially code moving and the test suite is happy, I'd consider this RFC.

comment:13 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 28308078f397d1de36fd0da417ac7da2544ba12d:

Fixed #22603 -- Reorganized classes in django.db.backends.

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