Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#5461 closed (fixed)

Give database backends a "creation" attribute instead of using get_creation_module()

Reported by: Adrian Holovaty Owned by: brantley
Component: Database layer (models, ORM) Version: master
Severity: Keywords: db-be-api
Cc: Ian Kelly, Leo Soto M., ivan.illarionov@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: UI/UX:

Description

Each database backend's DatabaseWrapper class should have a creation property that returns a subclass of django.db.backends.creation.BaseCreation, which contains all the information about how to create tables with the particular backend. BaseCreation is like BaseDatabaseOperations in django/db/backends/__init__.py, except it deals only with logic related to creation.

This was implemented in http://code.djangoproject.com/attachment/ticket/5106/backend-refactoring-v2-correct-bitrot.patch , but that patch is no longer valid, as some of it has been checked in already.

Attachments (8)

5461.patch (86.3 KB) - added by brantley 9 years ago.
5461-r8156.diff (90.3 KB) - added by Russell Keith-Magee 8 years ago.
Refactored Creation, Introspection and Client for backend
5461-r8194.diff (142.7 KB) - added by Russell Keith-Magee 8 years ago.
More refactored database backends - all SQL statements now behind backend interface.
5461-r8194.2.diff (141.3 KB) - added by Ramiro Morales 8 years ago.
5461-r8194.diff but with two small modifications as described in http://groups.google.com/group/django-developers/msg/adfdaf65a6dbc8a7?hl=en
5461-r8224.diff (150.2 KB) - added by Leo Soto M. 8 years ago.
Updated the patch after geodjango was merged to trunk
5461-r8225.diff (166.1 KB) - added by Russell Keith-Magee 8 years ago.
rc1 for Creation backend patch.
5461-r8225.2.diff (167.1 KB) - added by Russell Keith-Magee 8 years ago.
rc2 for Creation backend patch - mysql/validation.py was missing from rc1
5461-r8280.diff (167.4 KB) - added by Russell Keith-Magee 8 years ago.
rc3 for Creation backend patch - minor style changes, and some GIS fixes.

Download all attachments as: .zip

Change History (24)

comment:1 Changed 9 years ago by Adrian Holovaty

(In [6192]) Added django/db/backends/creation.py, with BaseCreation. Refs #5461

comment:2 Changed 9 years ago by Adrian Holovaty

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
>>> from django.db import connection

# We want connection.creation to return a backend-specific subclass
# of django.db.backends.creation.BaseCreation.

comment:3 Changed 9 years ago by Adrian Holovaty

(That was an example for the person who is about to claim this ticket.)

comment:4 Changed 9 years ago by cwebber

Owner: changed from nobody to cwebber

comment:5 Changed 9 years ago by anonymous

Owner: changed from cwebber to brantley

Changed 9 years ago by brantley

Attachment: 5461.patch added

comment:6 Changed 9 years ago by brantley

Has patch: set

I just added 5461.patch, and tested it as best I could with sqlite3 and mysql, obviously it needs testing on the other backends as well.

comment:7 Changed 9 years ago by anonymous

Needs tests: set

comment:8 Changed 9 years ago by Simon G. <dev@…>

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:9 Changed 9 years ago by Ian Kelly

Cc: ian.g.kelly@… added

comment:10 Changed 9 years ago by Ian Kelly

Cc: Ian Kelly added; ian.g.kelly@… removed

comment:11 Changed 8 years ago by Ramiro Morales

Keywords: db-be-api added

comment:12 Changed 8 years ago by Leo Soto M.

Cc: Leo Soto M. added

comment:13 Changed 8 years ago by Russell Keith-Magee

milestone: 1.0 beta

If v1.0 is the point at which we're guaranteeing interface compatibility, getting an interface like this one in place would seem to be fairly important. The most recent patch has some pretty bad bitrot, but it should be resurrectable.

Changed 8 years ago by Russell Keith-Magee

Attachment: 5461-r8156.diff added

Refactored Creation, Introspection and Client for backend

Changed 8 years ago by Russell Keith-Magee

Attachment: 5461-r8194.diff added

More refactored database backends - all SQL statements now behind backend interface.

Changed 8 years ago by Ramiro Morales

Attachment: 5461-r8194.2.diff added

5461-r8194.diff but with two small modifications as described in http://groups.google.com/group/django-developers/msg/adfdaf65a6dbc8a7?hl=en

Changed 8 years ago by Leo Soto M.

Attachment: 5461-r8224.diff added

Updated the patch after geodjango was merged to trunk

comment:14 Changed 8 years ago by Ivan Illarionov

Cc: ivan.illarionov@… added

django/db/backends/mysql/validation.py file is missing in all patches after 5461-r8194.diff

Changed 8 years ago by Russell Keith-Magee

Attachment: 5461-r8225.diff added

rc1 for Creation backend patch.

Changed 8 years ago by Russell Keith-Magee

Attachment: 5461-r8225.2.diff added

rc2 for Creation backend patch - mysql/validation.py was missing from rc1

Changed 8 years ago by Russell Keith-Magee

Attachment: 5461-r8280.diff added

rc3 for Creation backend patch - minor style changes, and some GIS fixes.

comment:15 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [8296]) Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.

comment:16 Changed 5 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

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