def gen_query_hash(sql):
 sql = COMMENTS_REGEX.sub('', sql)
 sql = ''.join(sql.split()).lower()
 return hashlib.md5(sql.encode('utf-8')).hexdigest()

def gen_query_hash ( sql ) : sql = COMMENTS_REGEX . sub ( '' , sql ) sql = '' . join ( sql . split ( ) ) . lower ( ) return hashlib . md5 ( sql . encode ( 'utf-8' ) ) . hexdigest ( )
return hash of the given query after stripping all comments .