general database modeling and django specific modeling
Posted
by
Shreko
on Stack Overflow
See other posts from Stack Overflow
or by Shreko
Published on 2010-08-05T22:05:49Z
Indexed on
2011/01/15
15:54 UTC
Read the original article
Hit count: 521
django-models
|database-modeling
I'm wondering what is the best way to model something like the following.
Lets say my company sells metal bars (parameters/fields are: length, profile_type, quantity etc.) of different profiles, where profiles may be pipe(pipe_diameter, wall_thickness) or hollow_rectangle(base, height, wall_thickness), or maybe some other profile with different parameters. Lets say maximum number of profiles would be 12, each profile having between 2-5 parameters.
Should everything be in a single table like table_bars: id, length, quantity, profile_type, pipe_diameter, wall_thickness, base, height, etc.) where profile type would be (pipe, rectangle etc.)
or should every shape have its own table with its own parameters and in table_bars keep only id, length, quantity profile_type and profile_id)
and are there any django specific issues is multiple tables are the best answer?
Thanks
© Stack Overflow or respective owner