Wednesday, February 22, 2017

Re: Routing to database based on user

Hi Tom,
Did the solution Ansii suggested work?
Have you got some scalability problem with this solution?

On Monday, 30 January 2012 19:01:21 UTC-3, Tom Eastman wrote:
Hey guys,

I'm writing a django project that will require me to route queries to
certain large databases based on who the logged in user is.

So all the tables for django.contrib.auth and session and stuff will be
in the 'central' database, as well as a table that maps users to which
database they need to use for the main app.

Can you help me come up with a way of routing database queries this way
using a Django database router?

At the start of the view could I take the logged in user from
request.user or wherever it is, and some how provide that variable to my
database router for the rest of the request?

All suggestions welcome.

Cheers!

        Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ddc8f84-abc3-4454-a9b0-b58de2f9939c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment