Re: [web2py] Many-many options

2012-09-13 Thread Derek
I'm all for 3NF but if you are making a postal address table and you want to split the states and cities out of the same table, even though they will almost always be used together, that's just dumb IMHO. You shouldn't have 3NF just for the sake of having it, you should use it if it makes sense.

Re: [web2py] Many-many options

2012-09-13 Thread Andrew W
Yes option 1 sounds right. Otherwise you're entering 4th normal form territory http://en.wikipedia.org/wiki/Fourth_normal_form There may be many ways to do things in web2py, but you should still have a good database design. --

Re: [web2py] Many-many options

2012-09-13 Thread Richard Vézina
:) Richard On Thu, Sep 13, 2012 at 12:15 PM, MichaelF wrote: > Thanks. Yes, option 1 is the 'approved' solution, I think. It doesn't get > tricky. > > And thanks for the link. I like anti-pattern books...great sanity checks. > Unfortunately, I find a lot of my code in them! :) > > > On Thursday

Re: [web2py] Many-many options

2012-09-13 Thread MichaelF
Thanks. Yes, option 1 is the 'approved' solution, I think. It doesn't get tricky. And thanks for the link. I like anti-pattern books...great sanity checks. Unfortunately, I find a lot of my code in them! :) On Thursday, September 13, 2012 9:45:38 AM UTC-6, Richard wrote: > > In this case the be

Re: [web2py] Many-many options

2012-09-13 Thread Richard Vézina
In this case the best approach will be to have a normalized schema that allow to use all the constraint required at the DB level... I think yo said the first proposal you made allow that... I like this book when it comes to tricky design, it gives ideas on how to solve the issues : http://pragprog

Re: [web2py] Many-many options

2012-09-13 Thread MichaelF
The P3 record will have text and/or file information that relates to several P1 records, or several P2 records, and sometimes both several P1 and several P2 records. The text info will be used to add to a document (a totally separate entity outside the db), and the file will be attached to the

Re: [web2py] Many-many options

2012-09-13 Thread Richard Vézina
Maybe with more details about the nature of the information to store, it could be easier to give an answer... You can also use the junction table to store weak entity attribute, that could avoid the P3 table. Richard On Thu, Sep 13, 2012 at 11:01 AM, MichaelF wrote: > This might be more of a S

[web2py] Many-many options

2012-09-13 Thread MichaelF
This might be more of a SQL design question, but if web2py handles one better than another, that would be good to know. Suppose I have three 'parent' records ((P1, P2, and P3), and I want to link P1 records with P3 records, and also P2 records with P3 records. Several options: Option 1: obviou