def denormalize(week_range): try: logger.info('%s fill started.' % TABLE_NAME) sql = SQL() sql.execute_batches(FILL_SQL, week_range) sql.commitclose() logger.info('%s fill finished.' % TABLE_NAME) except Exception as ex: logger.exception(ex, 'Critical error in denormalization: %s' % TABLE_NAME)