>
> Why not use the facilities for sharding that are built in?
>
> Database routers [1] are designed to allow you to have a single model
> definition, but decide which database connection is used at runtime
> based on properties of the objects involved.
>
> [1]http://docs.djangoproject.com/en/dev/topics/db/multi-db/#automatic-da...
>
I must have misunderstood the database routers then.
>From the documentation:
"db_for_read(model, **hints)
Suggest the database that should be used for read operations for
objects of type model."
I thought that means that all objects of type model must be routed to
the same database.
Could you give me an example of a database router that would -
- first look at the type of the object, if it's of the type Tweet then
look at the userid of the Tweet's author, take a modulo N of the
userid, and then routes to DB0 if the modulo is 0, DB1 if the modulo
is 1, etc?
Thanks
--
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.