Hi, I'm ThadeusB.

I code, I play, I love, I innovate

Table Inheritance with web2py DAL

It is possible to define common db columns, e.g. posted_by, posted_on, etc... once and define on the appropriate table to inherit these common columns.

The DAL makes this quite easy. You define a Table with the common fields that you would like to inherit from. When defining your database tables, you will pass this table along as an argument, web2py will handle inheriting its fields.

from gluon.sql import Table
dates = Table(None, 'tmp',
    Field('posted_on', 'datetime', default=request.now),
    Field('posted_by', db.auth_user, default=auth.user.id),

    Field('content', 'text'),

    Field('linkto', 'string', length=500),