def check_evolution()

in mozilla_schema_generator/validate_bigquery.py [0:0]


def check_evolution(base, head, verbose=False):
    def nop(*args, **kwargs):
        pass

    log = print if verbose else nop

    a, b = set(base), set(head)
    is_error = 0
    # error condition
    base_only = a - b
    if len(base_only) > 0:
        log("items removed from the base")
        log("\n".join([f"-{x}" for x in base_only]))
        log("")
        # set the status
        is_error = 1

    # informative only
    head_only = b - a
    if len(head_only) > 0:
        log("items added to the base")
        log("\n".join([f"+{x}" for x in head_only]))
        log("")
    return is_error