'Validate that if there are existing items with attributes, they are valid'

def validate_exising_items(self):

    attributes_list = [d.attribute_value for d in self.item_attribute_values]
    for item in frappe.db.sql(u'select    i.name,    iva.attribute_value    as    value\n DCTB  DCTB  DCTB from    `tabItem    Variant    Attribute`    iva,    `tabItem`    i    where    iva.attribute    =    %s\n DCTB  DCTB  DCTB and    iva.parent    =    i.name    and    i.has_variants    =    0', self.name, as_dict=1):
        if self.numeric_values:
            validate_is_incremental(self, self.name, item.value, item.name)
        else:
            validate_item_attribute_value(attributes_list, self.name, item.value, item.name)
