API Reference¶
Auto-generated from docstrings in the source. See SDK Reference for narrative usage examples.
akad.sdk.DataContractValidator
¶
Main entry point for pipeline integration.
Two ways to load the contract:
-
From a local file (dev / CI)::
DataContractValidator(contract_path="contracts/daily_sales.yaml").validate()
-
From the registry by name — no local file needed (Airflow workers)::
DataContractValidator( contract_name="daily_sales", registry_url="http://akad-registry:8000", ).validate()
validate()
¶
Run validation.
on_breach='warn': logs, notifies, returns result.on_breach='fail': logs, notifies, raises :exc:DataContractBreachError.
akad.sdk.DataContractBreachError
¶
Bases: Exception
akad.engine.validate(contract, extra_validators=None)
¶
Run all validators against the dataset described in contract.
Reads data from storage. Use validate_dataframe() for unit-test-friendly validation that skips the read step.
akad.engine.validate_dataframe(df, contract, extra_validators=None, reader_last_modified=None, _now=None)
¶
Run all validators against a pre-loaded DataFrame.
Designed for unit and integration tests — callers supply the DataFrame directly, no storage access needed.
akad.contract_loader.load_contract(path)
¶
Load and validate a contract YAML file.
Raises pydantic.ValidationError with clear messages if the file is invalid.
akad.registry_client.RegistryClient
¶
get_contract(name)
¶
Fetch the current version of a contract from the registry by name.
Raises httpx.HTTPStatusError if the contract is not found (404).
get_contract_version(name, version)
¶
Fetch a specific historical version of a contract — used by akad diff.
Raises httpx.HTTPStatusError if that version doesn't exist (404).
akad.profiler.profile_dataframe(df, *, max_allowed_values_cardinality=DEFAULT_MAX_ALLOWED_VALUES_CARDINALITY)
¶
Profile df and return schema/volume/quality fragments for a starter DataContract. Pure function — no I/O.
akad.profiler.generate_contract(df, *, name, dataset_format, owner_team, owner_email, location=None, table_name=None, connection_string=None, version='0.1.0', max_allowed_values_cardinality=DEFAULT_MAX_ALLOWED_VALUES_CARDINALITY)
¶
Profile df and assemble a full, validated starter DataContract.
akad.profiler.contract_to_yaml_dict(contract)
¶
Render contract as a plain dict for clean YAML dumping — drops the
None/default-only noise a raw model_dump() would otherwise emit, and
JSON-coerces enums so PyYAML doesn't choke on a StrEnum subclass.
akad.differ.diff_contracts(old, new)
¶
Compare old and new contract versions.
Returns every detected change, classified as BREAKING or NON_BREAKING for a consumer relying on old's guarantees. Pure function — no I/O, no registry access. Metadata, notifications, and consumer lists are not compared — they don't affect what the data looks like to a consumer.
akad.differ.DiffEntry
dataclass
¶
akad.differ.DiffSeverity
¶
Bases: StrEnum