Multi-tenant database

69 views
Skip to first unread message

zin

unread,
Mar 12, 2007, 9:11:27 AM3/12/07
to Django users
Is Django suitable for multi-tenant database application? i.e.
combining username and company_id as primary key

Malcolm Tredinnick

unread,
Mar 12, 2007, 9:32:59 AM3/12/07
to django...@googlegroups.com
On Mon, 2007-03-12 at 06:11 -0700, zin wrote:
> Is Django suitable for multi-tenant database application? i.e.
> combining username and company_id as primary key

We do not support multi-column primary keys at this point in time.

Malcolm


Tim Chase

unread,
Mar 12, 2007, 10:16:59 AM3/12/07
to django...@googlegroups.com
> Is Django suitable for multi-tenant database application? i.e.
> combining username and company_id as primary key

You omit some key details:

-are the tenants writing data, or just reading data?

If they're just reading data, you can jockey your views based on
the tenant. We're currently doing that in our current Django app.

-do you want to use the default Admin?

If you want to use the default Admin, no. You /can/ write your
own admin. This is a bit of a pain, but can be done. This might
be eased a bit in the newforms series. I haven't dug into it a
bit, but it sounds like it's designed to help here. Fortunately,
Django is just a framework, so it doesn't prevent you from doing
this. It just means that you can't take advantage of default
scaffolding and have to roll some of your own.

As previously mentioned by Malcom, Django doesn't currently
support multi-column keys.

Just a few ideas.

-tkc


Kenneth Gonsalves

unread,
Mar 12, 2007, 10:37:32 AM3/12/07
to django...@googlegroups.com

On 12-Mar-07, at 7:46 PM, Tim Chase wrote:

> As previously mentioned by Malcom, Django doesn't currently
> support multi-column keys.

their *is* unique_together, but will that suit your needs?

--

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/


James Bennett

unread,
Mar 12, 2007, 11:29:34 AM3/12/07
to django...@googlegroups.com
On 3/12/07, zin <mail...@gmail.com> wrote:
> Is Django suitable for multi-tenant database application? i.e.
> combining username and company_id as primary key

Django does not currently have support for composite keys. You can
fake this to a certain extent with unique_together, but from Django's
point of view only one column will be treated as the primary key.

--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Reply all
Reply to author
Forward
0 new messages