Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 15, 2010 16:40:53

Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

incrementing non primary keys.


I'm porting an old php app and have run into a bit of an issue. The
main problem is that we this app will need to be used by multiple
different companies. While I could just setup discreet instances, I'm
thinking that making the app multi-tenant would be a much wiser idea
and easier on resources, as traffic will be reasonably low, maybe
100-200 users a day. I also don't desire to deal with 4 installations
of the code, when one will do.

The specific problem I have though, is in the legacy app, the primary
key for a certain table is an auto incrementing integer. This needs be
kept separate for each tenant. What I'm planning on doing is making
the primary key a uuid, and using unique_together with an integer
field. However I could easily see a race condition with incrementing
the integer field. What is the best way to handle this situation?

Also, what is the best way of filtering based on the site_id? should i
store a setting with the session and filter based on that? I was
thinking about seeing if it's possible to use a middleware to change
it at run time based on the request url. Is that a good idea?

are there any documents on best practices for django multitenancy?

You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.


Board footer

Moderator control

Enjoy the 12th of December

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support