Django

Code

Ticket #1142 (assigned)

Opened 3 years ago

Last modified 3 weeks ago

Support for multiple database connections

Reported by: Simon Willison Assigned to: darylspitzer (accepted)
Milestone: post-1.0 Component: Database layer (models, ORM)
Version: Keywords: multiple database feature
Cc: gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com, alexandru.palade@loopback.ro, jb0t Triage Stage: Someday/Maybe
Has patch: 1 Needs documentation: 1
Needs tests: 0 Patch needs improvement: 1

Description

Django currently assumes that all models will be stored in a single database, and that only one database connection will be used for the duration of a request. This assumption does not scale to really large applications, where it is common for multiple database connections to be used in non-obvious ways.

Three examples include:

  1. Traditional replication, where all writes go to a single master database while reads are distributed across a number of slave databases.
  2. Sharding, where (for example) user accounts 1-1000 live on db1, 1001-2000 live on db2 etc.
  3. Different types of data live on different servers / clusters. Frequently accessed user profile data might be stored on a seperate database/cluster from log data which is frequently written but very rarely accessed.

At the very least, Django needs to allow more than one database connection to be maintained by the DB wrapper. The default should still be a single connection as this is the common case, but Django should not get in the way should multiple connections be desired.

Rather than having a single connection, how about maintaining a dictionary of connections? A "default" key could correspond to the connection that is used in most cases, but other connections can be configured in the settings file and assigned names. There would need to be a mechanism somewhere for Django model classes to be told which named connection they should use.

Simple replication may end up being a different issue entirely - it's possible that could be handled just with a custom DB backend that knows to send writes to one server and distribute reads across several others. The above change (where Django allows multiple DB connections) is still essential for more complex configurations.

More about this on the mailing list: http://groups.google.com/group/django-users/browse_thread/thread/d08f4975da831bb/75ede5e9c7f0db53

Attachments

py23_set_fix_28feb07.diff (0.6 kB) - added by afarnham@gmail.com on 02/28/07 12:18:05.
Fixes mulitple-db-support branch django/db/models/manager.py for Python 2.3

Change History

01/01/06 16:59:35 changed by ian@holsman.net

An Alternative to this would be to use something like CJDBC/Sequoia (https://forge.continuent.org/projects/sequoia/) and manage the clustering at a lower level to django itself.

the link is for a JDBC wrapper, but they also have a C++ library which might be useful. all that is needed is a python module ;-)

regards Ian

01/01/06 18:19:43 changed by Simon Willison

My limited experience with really large apps suggests that handling clustering at a lower level won't provide enough flexibility. For huge sites you end up having to take different scaling approaches for different bits of functionality - you might have one web service call (or RSS feed) that is hit more than anything else and needs to be scaled in a different way for example. You end up needing to scale different parts of the application in different ways, often using different databases for different parts of the app.

There are also other use-cases for multiple database connections outside of scaling - talking to two legacy applications at once for example.

01/05/06 21:24:34 changed by Kozmo Kid

Django may benefit from the ability to define connections at the application level that can override the sitewide setting. This would make it rather trivial to pull data in from multiple platforms.

An interface to SQLrelay (http://sqlrelay.sourceforge.net/) might help the scalability issue.

01/06/06 12:03:53 changed by Morten Bagai

Simon,

Per your recommendation here I'm just adding a brief description of the scenario in which we typically encounter this current limitation of Django:

In a mixed-database environment, We're typically faced with having to model data types hosted on different database servers. For example, web content may generally live on our MySQL servers, but some applications will need to incorporate invoice data from a MS SQL database. While it's certainly a general mess to have data spread out over multiple engines like this, I think it's also a fact that many developers (especially in small-medium corporate environments) are faced with, and not having the ability to easily manage data from different source within a Django app is going to be a serious limitation to these people.

The solutions of either being able to define a dictionary of database connections in the sitewide config file or being able to specify database connections on an application level, could both work well. I wonder, though, what exactly would be entailed in defining connections on the application level? Would applications generally be able to add their own settings file in which sitewide preferences could be overwritten, or would there be a specific module, like myapp.db.connections for specifying app-level connections? Maybe the simplest and most backward-compatible approach would be to keep a dictionary of named connections available to installed apps in the sitewide settings file as originally suggested.

Thanks. /Morten

04/23/06 18:31:00 changed by adrian

  • priority changed from normal to low.
  • severity changed from major to normal.

05/19/06 22:40:43 changed by anonymous

I would have to agree that this is a serious limitation. It is not always possible to restructure existing databases into a single database for use and it would be of great valu to be able to use the django database model to integrate multiple databases at some level.

06/12/06 05:57:34 changed by Go

  • type deleted.

06/14/06 08:24:02 changed by anonymous

  • type set to defect.

06/23/06 14:17:02 changed by jacob

(In [3198]) Created branch for MultipleDatabaseSupport. Refs #1142.

06/24/06 13:13:38 changed by anonymous

  • cc set to gary.wilson@gmail.com.

06/25/06 09:48:35 changed by Andy Dustman <farcepest@gmail.com>

  • cc changed from gary.wilson@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com.

07/02/06 07:46:11 changed by anonymous

  • severity changed from normal to blocker.
  • component changed from Database wrapper to Validators.
  • priority changed from low to high.
  • version set to new-admin.
  • milestone set to Version 0.91.
  • type changed from defect to enhancement.

07/02/06 08:00:19 changed by anonymous

  • severity changed from blocker to trivial.
  • component changed from Validators to django-admin.py.
  • priority changed from high to highest.
  • version changed from new-admin to SVN.
  • milestone deleted.
  • type changed from enhancement to task.

07/04/06 22:43:04 changed by hi-world cup

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com to hi-world, cup.
  • keywords set to rthml tab space editor js.
  • summary changed from Support for multiple database connections to hi-world cup.

07/04/06 22:53:10 changed by adrian

  • summary changed from hi-world cup to Support for multiple database connections.

07/09/06 16:28:47 changed by anonymous

  • cc changed from hi-world, cup to gary.wilson@gmail.com, farcepest@gmail.com.

07/19/06 11:11:26 changed by anonymous

What is current status of this? When can we expect to see this in trunk?

thanks, Forest

07/20/06 20:29:52 changed by adrian

  • priority changed from highest to normal.
  • severity changed from trivial to normal.

08/24/06 05:39:32 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com.

12/19/06 19:01:28 changed by nmccullough@rightnow.com

Has there been any progress on this feature? I am in a similar situation. My project needs to be able to query different databases for different pieces of data. Another suggestion would be to be able to over ride the connection settings at the app level.

12/19/06 19:38:53 changed by Gary Wilson <gary.wilson@gmail.com>

  • keywords deleted.
  • type changed from task to enhancement.
  • component changed from django-admin.py to Database wrapper.

reverted metadata spam.

01/20/07 16:26:06 changed by Simon G. <dev@simon.net.nz>

  • keywords set to multiple database.
  • version deleted.
  • stage changed from Unreviewed to Design decision needed.

01/21/07 16:54:49 changed by namiswaan@gmail.com

I hope this gets merged into the trunk soon.

02/02/07 07:27:55 changed by dleewo@gmail.com

Is multiple database support going to implemented?

At least in my case, I was looking at Django for an application for my company, but it will need to access at least 2 databases. The main one, plus a database from another product over which we have no control and can't change.

We would actually like it to be 3 databases with the 3rd one being for reporting data. We prefer to keep reporting data in a separate database for performance purposes and for scalability, but if absolutely necessary, we would put it in the dsame database as the main data. That still leaves us with at least 2 databases.

We have another app that was done in Java with Hibernate and Hibernate is currently accessing 4 databases from within the same app.

02/02/07 18:55:26 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch set to 1.
  • has_patch set to 1.
  • stage changed from Design decision needed to Accepted.
  • needs_docs set to 1.

According to MultipleDatabaseSupport, the branch is feature complete and seems to be only lacking documentation.

If anyone is using or has tested the multi db branch, please note your experiences here.

Marking patch needs improvement since the latest commit to the branch notes that tests are still failing.

02/09/07 14:35:03 changed by mmccarty@nrao.edu

Question: Does the patch for this also provide a work-around for keeping the native Django apps tables out of your database?

02/20/07 05:26:40 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si.

02/28/07 12:18:05 changed by afarnham@gmail.com

  • attachment py23_set_fix_28feb07.diff added.

Fixes mulitple-db-support branch django/db/models/manager.py for Python 2.3

03/10/07 17:11:37 changed by namiswaan@gmail.com

  • has_patch deleted.

It's been a long time since something has happened to this branch.. will it ever get included in the main trunk?

I wish to use this, but i want to stay with the current Django code. Is it possible to check-out the trunk and merge the changes from this branch?

03/10/07 17:12:26 changed by namiswaan@gmail.com

  • has_patch set to 1.

oops, reverting the hash patch flag i removed

03/11/07 01:49:46 changed by mtredinnick

Please post question like comment 28 to the users list, not this ticket. Ticket comments are for resolving the issue at hand, not seeking genera. information.

03/26/07 06:17:08 changed by robertmlamarca@yahoo.com

Hi there, I have been following this conversation. I am working with some friends on a research project that requires one, maybe several postgres dbs. It is a bit off-label, but were hoping to make use of some of the Django features.

Multiple Dbs is something long-term we might need. Can someone tell me how to install this patch? I am running latest Django code with Python 2.4

So far, I see some patch online with about four lines of code... My Python skills are somewhere around early intermediate.. so I am not sure if : a. if just placing that code in my latest subversion checkout (where the surrounding code looks a bit different than what is there).. constitutes an installation of this patch. and b. how can I use it?

Appreciate your patience and assistance.

Robert

05/24/07 13:38:23 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com.

06/03/07 20:36:14 changed by Brian Harring <ferringb@gmail.com>

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com.

06/22/07 14:33:20 changed by Forte

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com to lindemann@hotmail.com.
  • owner changed from adrian to jacob.
  • component changed from Database wrapper to Uncategorized.

06/22/07 21:10:23 changed by mtredinnick

  • cc changed from lindemann@hotmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com.
  • owner changed from jacob to adrian.
  • component changed from Uncategorized to Database wrapper.

Reverted spam.

09/15/07 14:35:55 changed by PhiR

  • keywords changed from multiple database to multiple database feature.

12/02/07 12:12:36 changed by jacob

  • stage changed from Design decision needed to Someday/Maybe.

12/06/07 09:02:50 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info.

02/27/08 05:50:48 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com.

02/29/08 12:54:00 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com.

03/16/08 20:40:59 changed by darylspitzer

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com.

03/17/08 19:51:19 changed by darylspitzer

  • owner changed from nobody to darylspitzer.
  • status changed from new to assigned.

I reviewed an API design with Jacob and Adrian (and others) and will now work on a prototype. Much of the credit for the API goes to Ben Ford (and his code should give me a big headstart).

(follow-up: ↓ 44 ) 03/17/08 20:28:44 changed by cmcavoy

I'm glad to see someone taking this ticket, it's something I've wanted for a long time. Any chance you can write up your planned API?

(in reply to: ↑ 43 ) 03/17/08 20:40:08 changed by darylspitzer

Replying to cmcavoy:

I'm glad to see someone taking this ticket, it's something I've wanted for a long time. Any chance you can write up your planned API?

I'll answer your question on django-developers.

03/20/08 18:12:54 changed by mzdaniel

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com.

03/21/08 11:08:54 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com.

03/24/08 17:04:56 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz.

03/26/08 10:53:48 changed by Joe Holloway <jholloway7+django@gmail.com>

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com.

04/11/08 01:03:39 changed by simeon

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com.

04/18/08 21:02:49 changed by Tom Carrick <knyght@gmail.com>

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com.

04/25/08 07:27:54 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info.

05/25/08 15:28:42 changed by Koen Biermans <koen.biermans@werk.belgie.be>

Ben Ford set up a mercurial repository for new work on multiple databases at http://hg.woe-beti.de. A track setup is available at http://trac.woe-beti.de.

06/04/08 09:59:19 changed by darylspitzer

See this django-developers thread for more discussion (including my API proposal): http://tinyurl.com/5q7oy5

06/16/08 17:04:00 changed by mrts

  • milestone set to post-1.0.

Not in scope for 1.0.

07/22/08 10:47:00 changed by paulforrester

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net.

07/28/08 15:49:56 changed by flosch

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de.

10/14/08 17:08:45 changed by Tarken

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com.

What is the current status on this issue? There doesn't appear to have been any visible movement in several months now, and this is something which would be very useful in a project I'm working on. I have a slightly different use case than the previously mentioned ones, however... and I'm sure it's not an entirely common one, but perhaps something to take into consideration.

The company I work for is sitting on a fairly large data warehouse for a number of clients. Each client has their own database, with a common schema, on one of two MS SQL 2k servers. In the near future, we will hopefully be moving some of these clients onto a PostgreSQL server (and in the distant future, it would be nice to move towards Greenplum; although that should be transparent with psycopg2, afaik). In addition, there is a separate database already running on the PostgreSQL server, which stores configuration parameters and which I am using for the Django system tables.

On every page load, I need Django to connect to database 'A' on the PostgreSQL server for any Django specific operations, then connect to an arbitrary database on either of the MS SQL servers, depending on which of our clients' data is currently being viewed. From what I've seen so far in the discussion in this ticket and on MultipleDatabaseSupport, this doesn't sound like it would likely be a supported scenario, as the connection to be used is determined dynamically, rather than a static connection chosen per model. In my case, all models apply across all database connections.

Now, I have made this work thus far with my own connection manager (http://dpaste.com/hold/84458/) but using it is somewhat kludgy and I'm sure it's far from a full implementation. I also had to apply a hack (http://code.google.com/p/django-pyodbc/issues/detail?id=18) to django-pyodbc and apply a pending patch (#6710) to Django in order to get it to work. Here is an example of why it in use: http://dpaste.com/hold/84465/

10/14/08 21:55:21 changed by mtredinnick

There has, in fact, been lots of activity. Perhaps you might wish to peruse the archives of django-developers, which is where design work takes place. This ticket is really just a placeholder that will be closed when we commit some kind of final solution (and possibly for patches as we get closer if the work is self-contained enough not to require a branch).

11/22/08 02:02:37 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com, alexandru.palade@loopback.ro.

12/15/08 11:25:24 changed by anonymous

  • cc changed from gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com, alexandru.palade@loopback.ro to gary.wilson@gmail.com, farcepest@gmail.com, eikke@eikke.com, peter.kese@ijs.si, chris.mcavoy@gmail.com, ferringb@gmail.com, iacobs@m0n5t3r.info, andrewjwilkinson@gmail.com, email@chrisbraybrook.com, daryl.spitzer@gmail.com, remco@diji.biz, mzdaniel@gmail.com, rik24d@gmail.com, stuartw@kcbbs.gen.nz, jholloway7+django@gmail.com, simeonf+django@gmail.com, knyght+django@gmail.com, spoof@spoofa.info, django@flypig.net, flori@n-schlachter.de, tarkatronic@gmail.com, alexandru.palade@loopback.ro, jb0t.

Add/Change #1142 (Support for multiple database connections)




Change Properties
Action