(self, ev, data)
return (self.get_part_name() % vals, dtm)
Generates part table name from template
Generates part table name from template
Generates part table name from template
def split_format(self, ev, data):
        """Generates part table name from template"""
        if self.conf.part_mode == 'batch_time':
            dtm = self.batch_info['batch_end']
        elif self.conf.part_mode == 'event_time':
            dtm = ev.ev_time
        elif self.conf.part_mode == 'current_time':
            dtm = datetime.datetime.now()
        elif self.conf.part_mode == 'date_field':
            dt_str = data[self.conf.part_field]
            if dt_str is None:
                raise Exception('part_field(%s) is NULL: %s' % (self.conf.part_field, ev))
            dtm = datetime.datetime.strptime(dt_str[:19], "%Y-%m-%d %H:%M:%S")
        else:
            raise UsageError('Bad value for part_mode: %s' %\
                    self.conf.part_mode)
        vals = {'parent': self.dest_table,
                'year': "%04d" % dtm.year,
                'month': "%02d" % dtm.month,
                'day': "%02d" % dtm.day,
                'hour': "%02d" % dtm.hour,
               }
        return (self.get_part_name() % vals, dtm)
def split_format ( self , ev , data ) : if self . conf . part_mode == 'batch_time' : dtm = self . batch_info [ 'batch_end' ] elif self . conf . part_mode == 'event_time' : dtm = ev . ev_time elif self . conf . part_mode == 'current_time' : dtm = datetime . datetime . now ( ) elif self . conf . part_mode == 'date_field' : dt_str = data [ self . conf . part_field ] if dt_str is None : raise Exception ( 'part_field(%s) is NULL: %s' % ( self . conf . part_field , ev ) ) dtm = datetime . datetime . strptime ( dt_str [ : 19 ] , "%Y-%m-%d %H:%M:%S" ) else : raise UsageError ( 'Bad value for part_mode: %s' % self . conf . part_mode ) vals = { 'parent' : self . dest_table , 'year' : "%04d" % dtm . year , 'month' : "%02d" % dtm . month , 'day' : "%02d" % dtm . day , 'hour' : "%02d" % dtm . hour , } return ( self . get_part_name ( ) % vals , dtm )