def __getattr__(self, name):
        """Returns a subclass of Relation for each table found in
        the model.

        N.B. This returns a class object rather than an instance.  From
        this object you can:-
           - query the database for a cursor,
           - instantiate an instance of the class (i.e. a single row 
             from the database)
           - obtain meta-data from the database table or view
        """
        if name.lower() in self.tables():
            DataSource = type(name, (Relation, dict), {})
            return DataSource
        else:
            raise AttributeError, 'Attribute %s not found' % name
Returns a subclass of Relation for each table found in
        the model.

        N.B. This returns a class object rather than an instance.  From
        this object you can:-
           - query the database for a cursor,
           - instantiate an instance of the class (i.e. a single row 
             from the database)
           - obtain meta-data from the database table or view
        
recipes/Python/473834_simple_Object_Relational/recipe-473834.py