I must be in a "search blind spot", I'm having trouble finding
references and examples for this pattern, though I feel certain I've
seen examples around the sqlalchemy literature a couple of times
before.

I have a table of Companies, and then further tables of Manufacturer
and Vendor info which apply to some companies.  So a company can be
stored just as a company, or as a company that happens to be a
manufacturer, and/or happens to be a vendor.  I don't want the
manufacturer and vendor designations to be exclusive of each other; it
should be possible for a company to be both.

I thought of just having a boolean field on the Company table for each
'child' type.  So (company.manufacturer == True) would tell me it's
safe to write to or read from attributes whose storage is in the
manufacturer info table.  Likewise, (company.vendor == True) would
indicate that it's safe to write to or read from attributes whose
storage is in the vendor info table.  And of course some companies
will be filed as neither, so I won't attempt to access mfr or vendor
info about them.

Regular SA joined-table inheritance doesn't work this way since it
requires a discriminator column taking a single value at a time.
Still I would love to use joined-table inheritance if I could.  Is
there a way?

Should I just try to do this with single-table inheritance or even
just go without SA's inheritance features and python my way to working
attributes that do what I wish based on a single table?

I just don't want to miss out if there's a way I could do this
elegantly (and fully normalized) with joined tables.  I'll admit that
single tables with some columns being defunct for some rows just bug
the normalization freak in me.

Thanks in advance.
Eric

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to