I'm wondering if you can directly implement the Table-per-type or Shared-primary-key method of inheritance in the DAL?
The standard DAL inheritance method (including a table as a field) is a Table-per-concrete approach that has pros and cons. In particular for me, it is harder to deal with the common stuff (the stuff in the superclass) with the standard DAL method. In many cases I never need to refer to the subclass specifics.
The best I have been able to do is something like the below. There is a lot of common stuff in the duration table (and, btw, the duration can be overridden and isn't necessarily the difference of the start and stop values in the subclasses). Depending on how the time is tracked, there are different algorithms used to compute a duration, for example subtracting two datetimes or subtracting two floats (representing hours).
db.define_table(
'duration',
# Common stuff
Field('duration','decimal(10,2)',notnull=True),
)
db.define_table(
'datetime_duration',
Field('superclass','reference duration',unique=True,notnull=True),
Field('start','datetime',notnull=True),
Field('stop','datetime',notnull=True),
)
db.define_table(
'hour_duration',
Field('superclass','reference duration',unique=True,notnull=True),
Field('start','decimal(10,2)',notnull=True),
Field('stop','decimal(10,2)',notnull=True),
)