Checks, Reporting & Pandera Integration#

DataSpector’s data-quality engine was originally inspired by seeing an enterprise IT project spend millions of dollars on commercial data-governance and auditing platforms (such as Varonis) to monitor shared file drops and database tables — when a fast, open-source Python engine could enforce richer source, record, and cross-source integrity controls and produce audit-ready Excel reports for free.

Built-in Check Catalog#

Source-Level Checks#

Record-Level Checks#

Data-Integrity Design & Pandera Integration#

DataSpector pairs format-agnostic source and streaming record checks with Pandera declarative schemas:

  • Source, Cross-Source & Streaming Record Controls: GenericData inspects file/table metadata (existence, modification timestamps, storage size, column names, row counts) without loading full datasets into memory, and streams records in fixed-size chunks through multi-chunk checks decorated with requires_all_data().

  • Automated Audit Reporting: pretty_print_results() renders instant terminal summaries, while write_excel_report() exports color-coded Excel audit workbooks preserving the driver structure with Passed (green TRUE / red FALSE), diagnostic Notes, and Exceptions columns.

  • Declarative Pandera Schemas: Pandera is lightweight, pandas-native, zero-infrastructure, supports YAML/JSON schema serialization, and validates each streamed pandas.DataFrame chunk cleanly via record_validate_schema() (including schemas auto-generated from COBOL copybooks via to_pandera_schema()).

Using record_validate_schema#

record_validate_schema() accepts:

  1. A pandera.pandas.DataFrameSchema instance.

  2. A concise Python dictionary (or JSON string) mapping column names to dtypes and checks (gt, ge, lt, le, in_range, isin, notin, str_length, str_matches, str_startswith, str_endswith, str_contains).

  3. A path to a Pandera .json or .yaml schema file.

  4. A path to a COBOL .cbl copybook (automatically converted via to_pandera_schema()).

import pandera.pandas as pa
import dataspector

schema = pa.DataFrameSchema(
    {
        "host": pa.Column(str, unique=True, checks=pa.Check.str_startswith("srv-app-")),
        "domain": pa.Column(int, checks=pa.Check.in_range(1, 10)),
    }
)

history = dataspector.run_checks_on_location(
    "tests/data/sample_excel.xlsx",
    [("record_validate_schema", {"schema": schema})],
)
assert history.all_passed