""").format(_table_name, fields_string, values_string)
	
				# Different MySQL Query if there is no license consumption
				else:
					insert_query = ("""
									INSERT INTO {0} 
									(`username`, `start`, `startDate`, `end`, `endDate`, `stream_type`, `stream_hash`, `seconds`) 
									VALUES ('%(username)s', %(start)s, '%(startDate)s', %(end)s, '%(endDate)s', '%(stream_type)s', '%(stream_hash)s', %(seconds)s);
									""").format(_table_name)
									
				# Concatenate all the INSERT statements    
				insert_string += " ".join(insert_query.split()) % data
	        	
			try:
				insert_count= 0
				cursor = mysql.execute_many(insert_string)
				for insert in cursor:
					insert_count += 1
					
				# Commit the inserts for the user (if there are results)
				if insert_count: mysql.commit()
				else:			mysql.close()
			except Exception, err:
				logging.exception(err)
				logging.error("Query: {0}".format(insert_string))
				continue
				
		else:
			logging.info("No streams consumed in the past 24 hours for user: {0}".format(username)) 
		
	logging.info("Tasks completed.")