Opened 13 months ago

Closed 4 months ago

#22603 closed Cleanup/optimization (fixed)

Reorganize code in django.db.backends

Reported by: aaugustin Owned by: timgraham
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 13 months ago by akaariai

  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 12 months ago by gchp

  • Owner changed from nobody to gchp
  • Status changed from new to assigned

comment:3 Changed 12 months ago by timo

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 12 months ago by gchp

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 12 months ago by timo

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

comment:6 Changed 7 months ago by timgraham

  • 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 5 months ago by berkerpeksag

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 5 months ago by gchp

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 5 months ago by timgraham

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 4 months ago by timgraham

  • Owner changed from gchp to timgraham

comment:11 Changed 4 months ago by timgraham

  • Has patch set

comment:12 Changed 4 months ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

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

comment:13 Changed 4 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 28308078f397d1de36fd0da417ac7da2544ba12d:

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

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