On Oct 15, 2011, at 10:17 AM, Michael Bayer wrote: > > On Oct 14, 2011, at 9:45 PM, Mark Erbaugh wrote: > >> There are two tables pump and curve. The curve table has three fields, >> curve_pn, head and gpm. The design is that the rows with the same curve_pn >> value represent x,y points (head,gpm) on a pump performance curve. Each row >> in the pump table has a curve_pn column that links to the performance curve >> for that pump. The same performance curve can apply to multiple pumps. >> >> To me it seems that there is a many-many relationship, yet there is no >> association table. This design works fine in straight SQL. To model it in >> SQLAlchemy, do I need to add an association table? For the purposes of this >> application, the data is read-only, but if it were not, if the data for a >> curve were to change, I would want it to change for all the pumps that use >> that curve_pn. > > SQLAlchemy's rules are more relaxed than relational database rules here, > which would definitely require that you use proper foreign keys. In SQLA's > case it populates local to remote from A->B as the configuration tells it to, > does a join on lookup, and primaryjoin/foreign_keys does what you need: >
Thanks -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.