#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)
Change History (24)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
>>> from django.db import connection # We want connection.creation to return a backend-specific subclass # of django.db.backends.creation.BaseCreation.
comment:4 by , 18 years ago
| Owner: | changed from to | 
|---|
comment:5 by , 18 years ago
| Owner: | changed from to | 
|---|
by , 18 years ago
| Attachment: | 5461.patch added | 
|---|
comment:6 by , 18 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 , 18 years ago
| Needs tests: | set | 
|---|
comment:8 by , 18 years ago
| Patch needs improvement: | set | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:9 by , 18 years ago
| Cc: | added | 
|---|
comment:10 by , 18 years ago
| Cc: | added; removed | 
|---|
comment:11 by , 17 years ago
| Keywords: | db-be-api added | 
|---|
comment:12 by , 17 years ago
| Cc: | added | 
|---|
comment:13 by , 17 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 , 17 years ago
| Attachment: | 5461-r8156.diff added | 
|---|
Refactored Creation, Introspection and Client for backend
by , 17 years ago
| Attachment: | 5461-r8194.diff added | 
|---|
More refactored database backends - all SQL statements now behind backend interface.
by , 17 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 , 17 years ago
| Attachment: | 5461-r8224.diff added | 
|---|
Updated the patch after geodjango was merged to trunk
comment:14 by , 17 years ago
| Cc: | added | 
|---|
django/db/backends/mysql/validation.py file is missing in all patches after 5461-r8194.diff
by , 17 years ago
| Attachment: | 5461-r8225.2.diff added | 
|---|
rc2 for Creation backend patch - mysql/validation.py was missing from rc1
by , 17 years ago
| Attachment: | 5461-r8280.diff added | 
|---|
rc3 for Creation backend patch - minor style changes, and some GIS fixes.
comment:15 by , 17 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
(In [6192]) Added django/db/backends/creation.py, with BaseCreation. Refs #5461