def check_data_table_similarity(old_dt_node, new_dt_node, new_column_vartypes, new_column_names, new_column_codes):
    if ((not old_dt_node) or (not new_dt_node)):
        raise Exception('Internal error 100')
    old_attribute_list = old_dt_node.find_child(names.ATTRIBUTELIST)
    new_attribute_list = new_dt_node.find_child(names.ATTRIBUTELIST)
    if (len(old_attribute_list.children) != len(new_attribute_list.children)):
        raise IndexError('The new table has a different number of columns from the original table.')
    document = current_user.get_filename()
    old_object_name_node = old_dt_node.find_descendant(names.OBJECTNAME)
    if (not old_object_name_node):
        raise Exception('Internal error 101')
    old_object_name = old_object_name_node.content
    if (not old_object_name):
        raise Exception('Internal error 102')
    (old_column_vartypes, _, _) = user_data.get_uploaded_table_column_properties(old_object_name)
    if (not old_column_vartypes):
        old_column_vartypes = get_column_properties(old_dt_node, old_object_name)
    if (old_column_vartypes != new_column_vartypes):
        diffs = []
        for (col_name, old_type, new_type, attr_node) in zip(new_column_names, old_column_vartypes, new_column_vartypes, old_attribute_list.children):
            if (old_type != new_type):
                diffs.append((col_name, old_type, new_type, attr_node))
        raise ValueError(diffs)
def check_data_table_similarity(old_dt_node, new_dt_node, new_column_vartypes, new_column_names, new_column_codes):
    if ((not old_dt_node) or (not new_dt_node)):
        raise Exception('Internal error 100')
    old_attribute_list = old_dt_node.find_child(names.ATTRIBUTELIST)
    new_attribute_list = new_dt_node.find_child(names.ATTRIBUTELIST)
    if (len(old_attribute_list.children) != len(new_attribute_list.children)):
        raise IndexError('The new table has a different number of columns from the original table.')
    document = current_user.get_filename()
    old_object_name_node = old_dt_node.find_descendant(names.OBJECTNAME)
    if (not old_object_name_node):
        raise Exception('Internal error 101')
    old_object_name = old_object_name_node.content
    if (not old_object_name):
        raise Exception('Internal error 102')
    (old_column_vartypes, _, _) = user_data.get_uploaded_table_column_properties(old_object_name)
    if (not old_column_vartypes):
        old_column_vartypes = get_column_properties(old_dt_node, old_object_name)
    if (old_column_vartypes != new_column_vartypes):
        diffs = []
        for (col_name, old_type, new_type, attr_node) in zip(new_column_names, old_column_vartypes, new_column_vartypes, old_attribute_list.children):
            if (old_type != new_type):
                diffs.append((col_name, old_type, new_type, attr_node))
        raise ValueError(diffs)