On Nov 15, 4:39 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-11-15 at 16:04 -0800, Brett Elliott wrote:
> > How can I 'shard' with Django? What I mean by sharding is accessing
> > multiple databases to combine data from multiple databases. This would
> > require access to the database connection API so that the view has
> > access to multiple database connections. Perhaps I could add code to a
> > filter to set up the connections, then somehow I can access those
> > connections from the view.
>
> At the moment, this isn't supported. There was some multi-db support
> done at one point and I thought somebody was going to be hosting that
> externally whilst they worked on it, but nothing seems to have been
> announced. However, that's not really sharding in any case: each field
> (possibly each model) would all be stored in a single database, just
> using multiple databases for storing different fields/models. Sharding
> usually refers to splitting the data set so that one group of rows are
> in one database and another are somewhere else (i.e. the same field has
> data in different locations). Sharding is much harding to make work in a
> truly generic sense that multiple database support.
Yes that is a better description of sharding. I do use sharding in
another project and I find it essential to scaling, but I had to do a
bit of one-off Java trickery to get it to work correctly. Sharding is
very had to get right in the general sense. One project that I know
of, Hibernate Shards for Java( http://www.hibernate.org/414.html,
thanks Google), seems to do a good job at it although I haven't used
it.
Assuming you have a person stored in one database and the person's
relatives stored in another database, I imagine an API that would
allow something like:
person = Person.shards.get(pk=123)
relatives = person.getRelatives()
then the shards manager would do:
def getRelatives(person):
database_id = person.database_id
dbinst = database.get(database_id)
relatives = Relative.shardmanager.get(person=person)
return relatives
I can start looking at the Django code to see if it can be made to do
something similar.
>
> Regards,
> Malcolm
>
> --
> Honk if you love peace and quiet.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---