Opened 17 years ago

Closed 16 years ago

Last modified 13 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: dev
Severity: Keywords: db-be-api
Cc: Erin Kelly, Leo Soto M., ivan.illarionov@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

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 17 years ago.
5461-r8156.diff (90.3 KB ) - added by Russell Keith-Magee 16 years ago.
Refactored Creation, Introspection and Client for backend
5461-r8194.diff (142.7 KB ) - added by Russell Keith-Magee 16 years ago.
More refactored database backends - all SQL statements now behind backend interface.
5461-r8194.2.diff (141.3 KB ) - added by Ramiro Morales 16 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. 16 years ago.
Updated the patch after geodjango was merged to trunk
5461-r8225.diff (166.1 KB ) - added by Russell Keith-Magee 16 years ago.
rc1 for Creation backend patch.
5461-r8225.2.diff (167.1 KB ) - added by Russell Keith-Magee 16 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 16 years ago.
rc3 for Creation backend patch - minor style changes, and some GIS fixes.

Download all attachments as: .zip

Change History (24)

comment:1 by Adrian Holovaty, 17 years ago

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

comment:2 by Adrian Holovaty, 17 years ago

>>> from django.db import connection

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

comment:3 by Adrian Holovaty, 17 years ago

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

comment:4 by cwebber, 17 years ago

Owner: changed from nobody to cwebber

comment:5 by anonymous, 17 years ago

Owner: changed from cwebber to brantley

by brantley, 17 years ago

Attachment: 5461.patch added

comment:6 by brantley, 17 years ago

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 by anonymous, 17 years ago

Needs tests: set

comment:8 by Simon G. <dev@…>, 17 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:9 by Erin Kelly, 17 years ago

Cc: ian.g.kelly@… added

comment:10 by Erin Kelly, 17 years ago

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

comment:11 by Ramiro Morales, 17 years ago

Keywords: db-be-api added

comment:12 by Leo Soto M., 16 years ago

Cc: Leo Soto M. added

comment:13 by Russell Keith-Magee, 16 years ago

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.

by Russell Keith-Magee, 16 years ago

Attachment: 5461-r8156.diff added

Refactored Creation, Introspection and Client for backend

by Russell Keith-Magee, 16 years ago

Attachment: 5461-r8194.diff added

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

by Ramiro Morales, 16 years ago

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

by Leo Soto M., 16 years ago

Attachment: 5461-r8224.diff added

Updated the patch after geodjango was merged to trunk

comment:14 by Ivan Illarionov, 16 years ago

Cc: ivan.illarionov@… added

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

by Russell Keith-Magee, 16 years ago

Attachment: 5461-r8225.diff added

rc1 for Creation backend patch.

by Russell Keith-Magee, 16 years ago

Attachment: 5461-r8225.2.diff added

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

by Russell Keith-Magee, 16 years ago

Attachment: 5461-r8280.diff added

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

comment:15 by Russell Keith-Magee, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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