class C(Base): if is_value_default: code = Text(default_value='alabala') else: code = Text() if is_reference: ime = Reference(Name, auto_set=is_auto_set, lazy=is_lazy) else: ime = Text() #TODO must make a deferred_column when is_lazy
class Employee(Base): auto_set = False #StaticTypeing; else: maximum recursion depth at cascade_* DBCOOK_inheritance = inh DBCOOK_has_instances = True name = Text() dept = Reference('Dept')
class Employee( Base): name = Text() age = Int() dept = o2r.Reference( 'Dept') lover = o2r.Reference( 'Employee') manager = o2r.Reference( 'Employee') #or 'Manager' DBCOOK_inheritance = inh #for subclasses - this one is always concrete anyway DBCOOK_has_instances = True #by default only class-tree leaves have instances
class Name(Base): nime = Text()
class Dept(Base): boss = Reference(Manager) name = Text()
class Hacker(Engineer): tools = Text()
class Dept( Base): manager = o2r.Reference( Manager) name = Text() director = o2r.Reference( 'Director')
class Engineer( Employee): machine = Text()
class Manager( Employee): secretary = o2r.Reference( Employee) extras = Text() DBCOOK_has_instances = True