Opened 17 years ago
Closed 17 years ago
#5454 closed (fixed)
Using a user-built DB backend
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | database backend sprintsept14 | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Since the DB backend refactoring, creating your own backend package has been easier than ever. Installing your customized backend in the Django source doesn't make sense, so the intention here is to be able to reference the backend somewhere outside the Django source.
This was discussed here with some favorable results on the django-dev list: http://groups.google.com/group/django-developers/browse_thread/thread/6bdfac9b1eac8d63/9ef5a73a61671cbd?lnk=gst&q=george+vilches&rnum=1#9ef5a73a61671cbd
Attachments (2)
Change History (9)
comment:1 by , 17 years ago
Summary: | Using a project specific backend → Using a user-built DB backend |
---|
by , 17 years ago
Attachment: | user_backend_r6186.patch added |
---|
comment:2 by , 17 years ago
Has patch: | set |
---|
The provided patch allows you to reference the backend in your settings.py file by putting a module path in DATABASE_ENGINE.
An example (assume I have an package in my path called 'db_backends', which contains a package called test1 that contains a fully-involved backend):
#DATABASE_ENGINE = 'mysql'
DATABASE_ENGINE = 'db_backends.test1'
DATABASE_NAME = 'test_db'
DATABASE_USER = 'test_user'
Either of the above DATABASE_ENGINE statements work with this patch. If you provide a package that doesn't exist, Django fails and returns the error message it always has.
comment:3 by , 17 years ago
Sorry, screwed up the example:
#DATABASE_ENGINE = 'mysql' DATABASE_ENGINE = 'db_backends.test1' DATABASE_NAME = 'test_db' DATABASE_USER = 'test_user'
comment:4 by , 17 years ago
Keywords: | sprintsept14 added |
---|
comment:5 by , 17 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Like the idea, like the interface - don't like the patch. get_creation_module and get_introspection_module now have a dependence on import_path, a global variable. This should probably be curried into the functions, rather than be left as a global reference.
by , 17 years ago
Attachment: | user_backend_r6284.patch added |
---|
Moved global variables to curried functions.
comment:6 by , 17 years ago
The current patch against r6284 removed the dependence on import path via django.utils.functional.curry.
comment:7 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Adds support for specifying a user backend against r6186.