Ejemplo n.º 1
0
class Match(Entity):
    id = field.PrimaryKey(storetype.Integer(), name='match_id')
    player_fk = rel.ManyToMany('Footballer', name='player')
Ejemplo n.º 2
0
class Footballer(Player):
    name = field.Column(storetype.Text(max_length=80))
    match_fk = rel.ManyToMany('Match', name='match')
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 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 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')