import storm from storm.locals import * class Zoo(Storm): __storm_table__ = 'Zoo' ID = Int(primary=True) Name = Unicode() Founded = Date() Opens = Time() LastEsc = DateTime() Admission = Float() def __init__(self, **kwargs): for k, v in kwargs.iteritems(): setattr(self, k, v) class Animal(Storm): __storm_table__ = 'Animal' ID = Int(primary=True) MotherID = Int() ZooID = Int() zoo = Reference("ZooID", "Zoo.ID") Name = Unicode() Species = Unicode() Legs = Int(default=4) LastEsc = DateTime() Lifespan = Float() mother = Reference(MotherID, ID) PrefFoodID = Int() AltFoodID = Int() def __init__(self, **kwargs): for k, v in kwargs.iteritems(): setattr(self, k, v)