1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #81 resolved

inheritance needs better way to map the parent/child columns together

Michael Bayer
repo owner created an issue

currently, a mapper that inherits from another relies upon the join column having the same name on both sides so that they are synched up on insert. if they dont, you have to use a "combined column" explicitly:

m = mapper(myclass, mytable, inherit=mapper2, properties = {
    'id' : [inheritedtable.c.foo_id](mytable.c.id,)

the logic that PropertyLoader uses for syncing, SyncRule, should be factored out to a new module "sync.py" which defines rules for taking SQL clauses and working out SyncRule objects that can be executed at any time. Mapper should then make use of the SyncRule idea, hardcoded to the "one-to-many" direction, when it takes in an inherit condition.