Exemple #1
0
    def print_db(self):
        a1 = event.alias()
        a2 = site.alias()
        a3 = player.alias()
        a4 = player.alias()

        s = select([
            game.c.id,
            a1.c.name.label('event'),
            a2.c.name.label('site'),
            a3.c.name.label('white'),
            a4.c.name.label('black'), game.c.date_year, game.c.date_month,
            game.c.date_day, game.c.eco, game.c.result, game.c.white_elo,
            game.c.black_elo
        ],
                   and_(game.c.event_id == a1.c.id, game.c.site_id == a2.c.id,
                        game.c.white_id == a3.c.id,
                        game.c.black_id == a4.c.id)).where(
                            and_(a3.c.name.startswith(unicode("Réti")),
                                 a4.c.name.startswith(unicode("Van Nüss"))))

        result = self.conn.execute(s)
        games = result.fetchall()
        for g in games:
            print("%s %s %s %s %s %s %s %s %s %s %s %s" %
                  (g['id'], g['event'], g['site'], g['white'], g['black'],
                   g[5], g[6], g[7], g['eco'], reprResult[g['result']],
                   g['white_elo'], g['black_elo']))
Exemple #2
0
    def print_db(self):
        a1 = event.alias()
        a2 = site.alias()
        a3 = player.alias()
        a4 = player.alias()

        s = select([game.c.id, a1.c.name.label('event'), a2.c.name.label('site'), a3.c.name.label('white'), a4.c.name.label('black'),
                    game.c.date_year, game.c.date_month, game.c.date_day, game.c.eco,
                    game.c.result, game.c.white_elo, game.c.black_elo],
                    and_(
                    game.c.event_id==a1.c.id,
                    game.c.site_id==a2.c.id,
                    game.c.white_id==a3.c.id,
                    game.c.black_id==a4.c.id)).where(and_(a3.c.name.startswith(unicode("Réti")), a4.c.name.startswith(unicode("Van Nüss"))))
                     
        result = self.conn.execute(s)
        games = result.fetchall()
        for g in games:
            print("%s %s %s %s %s %s %s %s %s %s %s %s" % (g['id'], g['event'], g['site'], g['white'], g['black'],
                g[5], g[6], g[7], g['eco'], reprResult[g['result']], g['white_elo'], g['black_elo']))