Django

Code

Ticket #5461 (closed: fixed)

Opened 1 year ago

Last modified 4 months ago

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

Reported by: adrian Assigned to: brantley
Milestone: 1.0 beta Component: Database layer (models, ORM)
Version: SVN Keywords: db-be-api
Cc: ikelly, leosoto, ivan.illarionov@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 1

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

5461.patch (86.3 kB) - added by brantley on 09/14/07 17:25:32.
5461-r8156.diff (90.3 kB) - added by russellm on 07/31/08 07:58:36.
Refactored Creation, Introspection and Client for backend
5461-r8194.diff (142.7 kB) - added by russellm on 08/02/08 03:37:02.
More refactored database backends - all SQL statements now behind backend interface.
5461-r8194.2.diff (141.3 kB) - added by ramiro on 08/02/08 13:44:23.
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 on 08/06/08 23:00:34.
Updated the patch after geodjango was merged to trunk
5461-r8225.diff (166.1 kB) - added by russellm on 08/09/08 09:53:34.
rc1 for Creation backend patch.
5461-r8225.2.diff (167.1 kB) - added by russellm on 08/09/08 10:27:28.
rc2 for Creation backend patch - mysql/validation.py was missing from rc1
5461-r8280.diff (167.4 kB) - added by russellm on 08/10/08 01:44:53.
rc3 for Creation backend patch - minor style changes, and some GIS fixes.

Change History

09/14/07 11:44:53 changed by adrian

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

09/14/07 11:51:15 changed by adrian

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.
>>> from django.db import connection

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

09/14/07 11:51:55 changed by adrian

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

09/14/07 11:52:42 changed by cwebber

  • owner changed from nobody to cwebber.

09/14/07 13:16:42 changed by anonymous

  • owner changed from cwebber to brantley.

09/14/07 17:25:32 changed by brantley

  • attachment 5461.patch added.

09/14/07 17:27:58 changed by brantley

  • has_patch set to 1.

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.

09/14/07 17:39:58 changed by anonymous

  • needs_tests set to 1.

09/16/07 04:18:46 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch set to 1.
  • stage changed from Unreviewed to Accepted.

09/18/07 13:25:28 changed by ikelly

  • cc set to ian.g.kelly@gmail.com.

03/17/08 16:32:57 changed by ikelly

  • cc changed from ian.g.kelly@gmail.com to ikelly.

06/25/08 11:35:52 changed by ramiro

  • keywords set to db-be-api.

07/13/08 22:05:57 changed by leosoto

  • cc changed from ikelly to ikelly, leosoto.

07/19/08 11:01:30 changed 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.

07/31/08 07:58:36 changed by russellm

  • attachment 5461-r8156.diff added.

Refactored Creation, Introspection and Client for backend

08/02/08 03:37:02 changed by russellm

  • attachment 5461-r8194.diff added.

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

08/02/08 13:44:23 changed by ramiro

  • 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

08/06/08 23:00:34 changed by leosoto

  • attachment 5461-r8224.diff added.

Updated the patch after geodjango was merged to trunk

08/07/08 00:14:52 changed by i_i

  • cc changed from ikelly, leosoto to ikelly, leosoto, ivan.illarionov@gmail.com.

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

08/09/08 09:53:34 changed by russellm

  • attachment 5461-r8225.diff added.

rc1 for Creation backend patch.

08/09/08 10:27:28 changed by russellm

  • attachment 5461-r8225.2.diff added.

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

08/10/08 01:44:53 changed by russellm

  • attachment 5461-r8280.diff added.

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

08/11/08 07:11:29 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(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.


Add/Change #5461 (Give database backends a "creation" attribute instead of using get_creation_module())




Change Properties
Action