Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 15, 2010 16:01:00

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

incrementing non primary keys.


If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 15, 2010 16:03:53

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

incrementing non primary keys.


If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 15, 2010 16:52:44

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

incrementing non primary keys.


If you are using a UUID for the primary key, do you really need an integer?

We had a similar multi-tenant need and didn't want to leak usage information to
the users, so we used UUID instead of auto incrementing integers.


On Dec 15, 2010, at 9:23 AM, Hutch wrote:

> Hi,
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 16, 2010 06:19:24

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

incrementing non primary keys.


Yes, the integer is needed, it's part of the spec. It's used for job
numbering. the problem being, they need not only an integer, but each
tenant needs sequential numbers.

if it was up to me, I would just remove it.

On Dec 15, 10:59 am, Eric Chamberlain <e...@rf.com> wrote:
> If you are using a UUID for the primary key, do you really need an integer?
>
> We had a similar multi-tenant need and didn't want to leak usage information
> to the users, so we used UUID instead of auto incrementing integers.
>
> On Dec 15, 2010, at 9:23 AM, Hutch wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 19th of August
PoweredBy

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