def update_customized_queries(conn, category_id, severity_id, query_id):
    if (is_conn(conn) and is_int(category_id) and is_int(severity_id) and is_int(query_id)):
        cursor = conn.cursor()
        cursor.execute('SELECT QueryId FROM dbo.Query                 WHERE PackageId IN (            SELECT DISTINCT PackageId FROM dbo.QueryGroup                 WHERE Name = (            SELECT Name FROM dbo.QueryGroup                 WHERE PackageId = (            SELECT DISTINCT PackageId FROM dbo.Query                 WHERE QueryId = ?)            ) and PackageId > 100000            ) and Name = (            SELECT DISTINCT Name FROM dbo.Query                 WHERE QueryId = ?)', (query_id, query_id))
        customized_queries_list = cursor.fetchall()
        if (len(customized_queries_list) > 0):
            for customized_query in customized_queries_list:
                cursor.execute('INSERT INTO dbo.CategoryForQuery                     (Id, QueryId,CategoryId) VALUES                    ((SELECT max(Id)+1 FROM dbo.CategoryForQuery), ?,?)', (customized_query[0], category_id))
                conn.commit()
            cursor.execute('UPDATE dbo.QueryVersion SET Severity = ?                 WHERE QueryId IN (                SELECT QueryId FROM dbo.QueryVersion                     WHERE PackageId IN (                SELECT DISTINCT PackageId FROM dbo.QueryGroup                     WHERE Name = (                SELECT Name FROM dbo.QueryGroup                     WHERE PackageId = (                SELECT DISTINCT PackageId FROM dbo.QueryVersion                     WHERE QueryId = ?)                ) and PackageId > 100000                ) and Name = (                SELECT DISTINCT Name FROM dbo.QueryVersion                     WHERE QueryId = ?)                )', (severity_id, query_id, query_id))
            conn.commit()
            cursor.execute('UPDATE dbo.Query SET Severity = ?                     WHERE QueryId IN (                SELECT QueryId FROM dbo.Query                     WHERE PackageId IN (                SELECT DISTINCT PackageId FROM dbo.QueryGroup                     WHERE Name = (                SELECT Name FROM dbo.QueryGroup                     WHERE PackageId = (                SELECT DISTINCT PackageId FROM dbo.Query                     WHERE QueryId = ?)                ) and PackageId > 100000                ) and Name = (                SELECT DISTINCT Name FROM dbo.Query                     WHERE QueryId = ?)                )', (severity_id, query_id, query_id))
            conn.commit()
            print('Updating Customized Queries Severity', severity_id, '- Query ID -', query_id)
        else:
            print('No existing customized queries for', query_id)
        return True
    else:
        raise AttributeError('Connection object bwas not provided')
def update_customized_queries(conn, category_id, severity_id, query_id):
    if (is_conn(conn) and is_int(category_id) and is_int(severity_id) and is_int(query_id)):
        cursor = conn.cursor()
        cursor.execute('SELECT QueryId FROM dbo.Query                 WHERE PackageId IN (            SELECT DISTINCT PackageId FROM dbo.QueryGroup                 WHERE Name = (            SELECT Name FROM dbo.QueryGroup                 WHERE PackageId = (            SELECT DISTINCT PackageId FROM dbo.Query                 WHERE QueryId = ?)            ) and PackageId > 100000            ) and Name = (            SELECT DISTINCT Name FROM dbo.Query                 WHERE QueryId = ?)', (query_id, query_id))
        customized_queries_list = cursor.fetchall()
        if (len(customized_queries_list) > 0):
            for customized_query in customized_queries_list:
                cursor.execute('INSERT INTO dbo.CategoryForQuery                     (Id, QueryId,CategoryId) VALUES                    ((SELECT max(Id)+1 FROM dbo.CategoryForQuery), ?,?)', (customized_query[0], category_id))
                conn.commit()
            cursor.execute('UPDATE dbo.QueryVersion SET Severity = ?                 WHERE QueryId IN (                SELECT QueryId FROM dbo.QueryVersion                     WHERE PackageId IN (                SELECT DISTINCT PackageId FROM dbo.QueryGroup                     WHERE Name = (                SELECT Name FROM dbo.QueryGroup                     WHERE PackageId = (                SELECT DISTINCT PackageId FROM dbo.QueryVersion                     WHERE QueryId = ?)                ) and PackageId > 100000                ) and Name = (                SELECT DISTINCT Name FROM dbo.QueryVersion                     WHERE QueryId = ?)                )', (severity_id, query_id, query_id))
            conn.commit()
            cursor.execute('UPDATE dbo.Query SET Severity = ?                     WHERE QueryId IN (                SELECT QueryId FROM dbo.Query                     WHERE PackageId IN (                SELECT DISTINCT PackageId FROM dbo.QueryGroup                     WHERE Name = (                SELECT Name FROM dbo.QueryGroup                     WHERE PackageId = (                SELECT DISTINCT PackageId FROM dbo.Query                     WHERE QueryId = ?)                ) and PackageId > 100000                ) and Name = (                SELECT DISTINCT Name FROM dbo.Query                     WHERE QueryId = ?)                )', (severity_id, query_id, query_id))
            conn.commit()
            print('Updating Customized Queries Severity', severity_id, '- Query ID -', query_id)
        else:
            print('No existing customized queries for', query_id)
        return True
    else:
        raise AttributeError('Connection object bwas not provided')