コード例 #1
0
def _query_missing(query, check, attr):
    """
    Query for any missing attributes

    :param query: query to execute
    :param items_name: name of the missing attribute
    :return: None
    """
    historic_count = 0
    for data in _get_data(query):
        if data.get('eind_geldigheid') is None:
            # Report actual warnings
            # Create an issue for the failing check
            # The entity that contains the error is data, the id-attribute is named id
            # The attribute that is in error is called bronwaarde
            issue = Issue(check, data, 'id', 'bronwaarde')
            issue.attribute = attr  # Set the name of the attribute that has the failing bronwaarde
            log_issue(logger, QA_LEVEL.WARNING, issue)
        else:
            # Count historic warnings
            historic_count += 1

    items_name = f"{attr} {check['msg']}"
    if historic_count > 0:
        logger.data_info(f"{items_name}: {historic_count} historical errors")
コード例 #2
0
def check_relation_conflicts(catalog_name, collection_name, attribute_name):
    updater = Relater(catalog_name, collection_name, attribute_name)
    result = updater.get_conflicts()

    for row in result:
        row = dict(row)
        # Log conflicting relations
        if (row.get("row_number") or 0) > 1:
            row['volgnummer'] = row.get('src_volgnummer')
            issue = Issue(QA_CHECK.Unique_destination, row, 'src_id',
                          'bronwaarde')
            issue.attribute = attribute_name
            log_issue(logger, QA_LEVEL.WARNING, issue)