Opened 17 years ago

Closed 17 years ago

#5454 closed (fixed)

Using a user-built DB backend

Reported by: George Vilches <gav@…> 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)

user_backend_r6186.patch (3.1 KB ) - added by George Vilches <gav@…> 17 years ago.
Adds support for specifying a user backend against r6186.
user_backend_r6284.patch (3.5 KB ) - added by George Vilches <gav@…> 17 years ago.
Moved global variables to curried functions.

Download all attachments as: .zip

Change History (9)

comment:1 by George Vilches <gav@…>, 17 years ago

Summary: Using a project specific backendUsing a user-built DB backend

by George Vilches <gav@…>, 17 years ago

Attachment: user_backend_r6186.patch added

Adds support for specifying a user backend against r6186.

comment:2 by George Vilches <gav@…>, 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 George Vilches <gav@…>, 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 George Vilches <gav@…>, 17 years ago

Keywords: sprintsept14 added

comment:5 by Russell Keith-Magee, 17 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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 George Vilches <gav@…>, 17 years ago

Attachment: user_backend_r6284.patch added

Moved global variables to curried functions.

comment:6 by George Vilches <gav@…>, 17 years ago

The current patch against r6284 removed the dependence on import path via django.utils.functional.curry.

comment:7 by Jacob, 17 years ago

Resolution: fixed
Status: newclosed

(In [6316]) Fixed #5454: settings.DATABASE_BACKEND may now refer to an external package (i.e. one located outside the Django source. Thanks, George Vilches.

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