DataSpector Documentation#
DataSpector is a pure-Python library and CLI combining enterprise
data-quality & integrity auditing (dataspector) with COBOL copybook &
mainframe data extract conversion (coboller):
Enforce format-agnostic data-integrity checks & automated audit reporting across CSV, TSV, Excel, fixed-width text, Parquet, JSON/JSONL, HDF5, COBOL datasets, and any SQLAlchemy database (SQLite, PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, DuckDB, MS Access) using a unified URI locator syntax (see Supported Data Sources & Unified Locator Syntax) — inspired by replacing million-dollar enterprise data-governance suites (like Varonis) with an open-source engine that runs 22+ source, record, cross-source reconciliation, and declarative Pandera schema checks from Python or an Excel driver workbook and exports color-coded Excel audit reports.
Read & convert COBOL mainframe extracts in pure Python — decode EBCDIC (
cp500,cp037),COMP-3packed decimals,COMP-6,COMP/COMP-5/COMP-X,COMP-1/COMP-2(IEEE & IBM HFP), signed zoned decimals,OCCURS,REDEFINES, UTF-8, DBCS, and bitfields directly into clean, human-readable CSV, TSV, JSON/JSONL, Excel, Parquet, or pandas DataFrames viadataspector.cobollerand thecobollerCLI.
Run Data-Integrity Checks & Generate Excel Audit Reports#
Audit any file, database table, or mainframe extract from Python or an Excel driver workbook:
>>> import dataspector
>>> results = dataspector.run_checks_on_location(
... "tests/data/sample_csv.csv",
... [
... ("source_exists", {}),
... ("source_has_N_fields", {"n_fields": 5}),
... ("record_count", {"nrows": 31}),
... ("record_field_not_null", {"field": "Cost Center"}),
... ("record_field_numeric_value_between", {"field": "Cost [CAD]", "constraint": (0, 200000)}),
... ],
... )
>>> results.all_passed
True
>>> dataspector.write_excel_report({"Sample CSV": results}, "audit_report.xlsx")
Or run an entire multi-source audit suite in parallel from an Excel driver file:
uv run dataspector --driver test_driver.xlsx --output report.xlsx --use_multiprocess true
Address any file, COBOL extract, or SQL database using the same unified locator
syntax (see Supported Data Sources & Unified Locator Syntax for the full reference, DataSourceSpec, and
optional SQLAlchemy DB extras):
csv://drops/daily_drop.dat
excel://reports/q1.xlsx#Sheet1
cobol://layouts/acct.cbl::extracts/acct.dat?encoding=cp500
sqlite:///data/warehouse.sqlite#accounts
postgresql+psycopg://${PG_USER}:${PG_PASS}@db.internal:5432/prod#public.users
mysql+pymysql://${MYSQL_USER}:${MYSQL_PASS}@host:3306/shop#orders
Read & Convert a COBOL Mainframe Extract in 3 Lines#
>>> from dataspector.coboller import Copybook
>>> cbl = Copybook("tests/data/sample_cobol_mainframe.cbl")
>>> df = cbl.to_dataframe("tests/data/sample_cobol_mainframe.dat", encoding="cp500", include_filler=False)
>>> cbl.convert("tests/data/sample_cobol_mainframe.dat", "accounts.csv", encoding="cp500")
PosixPath('accounts.csv')
Or directly from the command line:
uv run coboller inspect tests/data/sample_cobol_mainframe.cbl --omit_filler true
uv run coboller convert tests/data/sample_cobol_mainframe.cbl tests/data/sample_cobol_mainframe.dat --encoding cp500 --output accounts.csv
Contents#
Usage Guide — Installation, CLI/Python usage, Excel driver workbooks, and extending DataSpector.
Supported Data Sources & Unified Locator Syntax — Unified URI/scheme locator syntax,
DataSourceSpec,${ENV_VAR}secret interpolation, and optional SQLAlchemy DB extras (PostgreSQL, MySQL/MariaDB, Oracle, DuckDB, SQL Server, SQLite, MS Access).Read & Convert COBOL Mainframe Extracts (coboller) — Reading COBOL copybooks, converting mainframe EBCDIC/COMP-3 extracts, and the 69-copybook / 37-extract benchmark.
Checks, Reporting & Pandera Integration — Built-in source/record checks and Pandera schema integration.
API Reference — Full API reference for
core,coboller,checkers,cli, andsettings.Enterprise Consulting & Support Services — Enterprise consulting, custom mainframe COBOL/EBCDIC migration pipelines, and automated data-governance audit solutions.