code: def filldb(self):
          '''Fill database
          '''
          from app import World, Fortune, odm, MAXINT
  
          mapper = odm.Mapper(self.cfg.postgresql)
          mapper.register(World)
          mapper.register(Fortune)
          mapper.table_create()
  
          with mapper.begin() as session:
              query = session.query(mapper.world)
              N = query.count()
              todo = max(0, MAXINT - N)
              if todo:
                  for _ in range(todo):
                      world = mapper.world(randomNumber=randint(1, MAXINT))
                      session.add(world)
  
          if todo:
              odm.logger.info('Created %d World models', todo)
          else:
              odm.logger.info('%d World models already available', Nf filldb(self):
          '''Fill database
          '''
          from app import World, Fortune, odm, MAXINT
  
          mapper = odm.Mapper(self.cfg.postgresql)
          mapper.register(World)
          mapper.register(Fortune)
          mapper.table_create()
  
          with mapper.begin() as session:
              query = session.query(mapper.world)
              N = query.count()
              todo = max(0, MAXINT - N)
              if todo:
                  for _ in range(todo):
                      world = mapper.world(randomNumber=randint(1, MAXINT))
                      session.add(world)
  
          if todo:
              odm.logger.info('Created %d World models', todo)
          else:
              odm.logger.info('%d World models already available', N)
docs: Fill database