class Monkey(Mammal): _table_name = 'monkey' monkey_name = field.Column(storetype.Text(max_length=80)) monkey_weight = field.Column(storetype.Float())
class Footballer(Player): name = field.Column(storetype.Text(max_length=80)) match_fk = rel.ManyToMany('Match', name='match')
class Person(Entity): # simple class # _table_name = 'osoba' _first_name = field.Column(storetype.Text(max_length=30), name="first_name") _second_name = field.Column(storetype.Text(max_length=80))
class Mammal(Animal): _table_name = 'mammal' mammal_type = field.Column(storetype.Text(max_length=30), name="mammal_type")
class Poem(Entity): # multiple many to many relation id = field.PrimaryKey(storetype.Integer(), name='id') title = field.Column(storetype.Text(max_length=30), name='title') author_fk = rel.ManyToMany('Author', name='author_fk')
class Author(Entity): # multiple many to many relation id = field.PrimaryKey(storetype.Integer(), name='id') name = field.Column(storetype.Text(max_length=30), name='name') book_fk = rel.ManyToMany('Book', name='book_fk') poem_fk = rel.ManyToMany('Poem')
class Actor(Entity): # many to many relation id = field.PrimaryKey(storetype.Integer(), name='id') name = field.Column(storetype.Text(max_length=30), name='name') film_fk = rel.ManyToMany('Film', name='film_fk')
class City(Entity): # one to one relation _table_name = 'miasto' id = field.PrimaryKey(storetype.Integer(), name='id') name = field.Column(storetype.Text(max_length=30), name='name') address_fk = rel.OneToOne('Address', name='address_fk')
class Address(Entity): # many to one relation # _table_name = 'adres' id = field.Column(storetype.Text(max_length=30), name='id', unique=True, nullable=False) person_fk = rel.ManyToOne('Person', "person_fk")