Skip to content

verify

sqllocks_spindle.verify

Spindle verify — standalone quality and integrity verification.

Classes

VerifyReport

Renders a VerifyResult as Markdown or JSON.

Methods:
to_json(indent=2)

Serialize result to a JSON string.

to_markdown()

Render result as a reproducible Markdown report.

VerifyResult dataclass

Outcome of a spindle verify run.

VerifyRunner

Run a curated set of validation gates against synthetic data tables.

Without a schema: only records row counts (nothing to validate against). With a schema: adds schema conformance, null constraint, PK uniqueness, and FK checks. With statistical=True: also runs distribution gate (requires scipy).

Parameters:

Name Type Description Default
schema SpindleSchema | None

Parsed SpindleSchema for validation. Optional.

None
statistical bool

Include distribution drift checks (KS test / chi-squared).

False
data_path str

Original data path (for reporting). Optional.

''
schema_path str | None

Original schema path (for reporting). Optional.

None
Methods:
run(tables)

Run gates against tables and return a VerifyResult.

Parameters:

Name Type Description Default
tables dict[str, DataFrame]

Dict mapping table name to DataFrame.

required

Returns:

Type Description
VerifyResult

VerifyResult with gate outcomes, row counts, and metadata.

Functions:

load_tables(path, fmt)

Load one or more data files into a dict of DataFrames keyed by table name.

Parameters:

Name Type Description Default
path str

Path to a single file or a directory containing data files.

required
fmt str

File format — one of "csv", "parquet", "jsonl".

required

Returns:

Type Description
dict[str, DataFrame]

Dict mapping stem name (filename without extension) to DataFrame.

dict[str, DataFrame]

Empty dict if a directory contains no matching files.

Raises:

Type Description
FileNotFoundError

If path does not exist.

ValueError

If fmt is not supported.