Opened 8 years ago

Closed 7 years ago

Last modified 4 years ago

#5461 closed (fixed)

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

Reported by: adrian Owned by: brantley
Component: Database layer (models, ORM) Version: master
Severity: Keywords: db-be-api
Cc: ikelly, leosoto, 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 8 years ago.
5461-r8156.diff (90.3 KB) - added by russellm 7 years ago.
Refactored Creation, Introspection and Client for backend
5461-r8194.diff (142.7 KB) - added by russellm 7 years ago.
More refactored database backends - all SQL statements now behind backend interface.
5461-r8194.2.diff (141.3 KB) - added by ramiro 7 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 leosoto 7 years ago.
Updated the patch after geodjango was merged to trunk
5461-r8225.diff (166.1 KB) - added by russellm 7 years ago.
rc1 for Creation backend patch.
5461-r8225.2.diff (167.1 KB) - added by russellm 7 years ago.
rc2 for Creation backend patch - mysql/validation.py was missing from rc1
5461-r8280.diff (167.4 KB) - added by russellm 7 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 8 years ago by adrian

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

comment:2 Changed 8 years ago by adrian

  • 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 8 years ago by adrian

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

comment:4 Changed 8 years ago by cwebber

  • Owner changed from nobody to cwebber

comment:5 Changed 8 years ago by anonymous

  • Owner changed from cwebber to brantley

Changed 8 years ago by brantley

comment:6 Changed 8 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 8 years ago by anonymous

  • Needs tests set

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

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:9 Changed 8 years ago by ikelly

  • Cc ian.g.kelly@… added

comment:10 Changed 7 years ago by ikelly

  • Cc ikelly added; ian.g.kelly@… removed

comment:11 Changed 7 years ago by ramiro

  • Keywords db-be-api added

comment:12 Changed 7 years ago by leosoto

  • Cc leosoto added

comment:13 Changed 7 years ago by russellm

  • milestone set to 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 7 years ago by russellm

Refactored Creation, Introspection and Client for backend

Changed 7 years ago by russellm

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

Changed 7 years ago by ramiro

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

Changed 7 years ago by leosoto

Updated the patch after geodjango was merged to trunk

comment:14 Changed 7 years ago by i_i

  • Cc ivan.illarionov@… added

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

Changed 7 years ago by russellm

rc1 for Creation backend patch.

Changed 7 years ago by russellm

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

Changed 7 years ago by russellm

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

comment:15 Changed 7 years ago by russellm

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

(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 4 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta deleted

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