How to use the fastavro.validation.validate_many function in fastavro

To help you get started, we’ve selected a few fastavro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastavro / fastavro / tests / test_validation.py View on Github external
def validation_boolean(schema, *records):
    return validate_many(records, schema, raise_errors=False)
github fastavro / fastavro / tests / test_validation.py View on Github external
def validation_raise(schema, *records):
    return validate_many(records, schema, raise_errors=True)
github fastavro / fastavro / benchmark / benchmark.py View on Github external
def validater(schema, records, runs=1):
    times = []
    valid = []
    schema = parse_schema(schema)
    for _ in range(runs):
        start = time.time()
        valid = validate_many(records, schema)
        end = time.time()
        times.append(end - start)
    print('... {0} runs averaged {1} seconds'.format(runs, (sum(times) / runs)))
    return valid