Django

Code

Ticket #5454 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Using a user-built DB backend

Reported by: George Vilches <gav@thataddress.com> Assigned to: nobody
Milestone: Component: Database wrapper
Version: SVN Keywords: database backend sprintsept14
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

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

user_backend_r6186.patch (3.1 kB) - added by George Vilches <gav@thataddress.com> on 09/14/07 08:20:37.
Adds support for specifying a user backend against r6186.
user_backend_r6284.patch (3.5 kB) - added by George Vilches <gav@thataddress.com> on 09/15/07 08:13:29.
Moved global variables to curried functions.

Change History

09/14/07 08:17:52 changed by George Vilches <gav@thataddress.com>

  • needs_better_patch changed.
  • summary changed from Using a project specific backend to Using a user-built DB backend.
  • needs_tests changed.
  • needs_docs changed.

09/14/07 08:20:37 changed by George Vilches <gav@thataddress.com>

  • attachment user_backend_r6186.patch added.

Adds support for specifying a user backend against r6186.

09/14/07 08:25:40 changed by George Vilches <gav@thataddress.com>

  • has_patch set to 1.

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.

09/14/07 08:26:23 changed by George Vilches <gav@thataddress.com>

Sorry, screwed up the example:

#DATABASE_ENGINE = 'mysql' 
DATABASE_ENGINE = 'db_backends.test1' 
DATABASE_NAME = 'test_db' 
DATABASE_USER = 'test_user'

09/14/07 14:35:26 changed by George Vilches <gav@thataddress.com>

  • keywords changed from database backend to database backend sprintsept14.

09/15/07 00:36:50 changed by russellm

  • needs_better_patch set to 1.
  • stage changed from Unreviewed to 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.

09/15/07 08:13:29 changed by George Vilches <gav@thataddress.com>

  • attachment user_backend_r6284.patch added.

Moved global variables to curried functions.

09/15/07 08:14:54 changed by George Vilches <gav@thataddress.com>

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

09/15/07 14:25:20 changed by jacob

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

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


Add/Change #5454 (Using a user-built DB backend)




Change Properties
Action