def load_patterns(cur, pat_table_name, query_table_name):
    """
        load pre-defined constraints(currently only fixed attributes and variable attributes)
    """
    global_pattern_table = pat_table_name + '_global'
    load_query = 'SELECT * FROM {};'.format(global_pattern_table)
    cur.execute(load_query)
    res = cur.fetchall()
    patterns = []
    pattern_dict = [{}, {}]
    for pat in res:
        patterns.append(list(pat))
        f_key = str(sorted(patterns[-1][0]))
        v_key = str(sorted(patterns[-1][1]))
        if v_key not in pattern_dict[0]:
            pattern_dict[0][v_key] = {}
        if f_key not in pattern_dict[0][v_key]:
            pattern_dict[0][v_key][f_key] = []
        pattern_dict[0][v_key][f_key].append(patterns[-1])
        if f_key not in pattern_dict[1]:
            pattern_dict[1][f_key] = {}
        if v_key not in pattern_dict[1][f_key]:
            pattern_dict[1][f_key][v_key] = []
        pattern_dict[1][f_key][v_key].append(patterns[-1])
    schema_query = (
        """select column_name, data_type, character_maximum_length
        from INFORMATION_SCHEMA.COLUMNS where table_name='{}'"""
        .format(query_table_name))
    cur.execute(schema_query)
    res = cur.fetchall()
    schema = {}
    for s in res:
        schema[s[0]] = s[1]
    return patterns, schema, pattern_dict
