Skip to content

Installation ​

Python SDK ​

The Python SDK is the primary interface for Kanoniv. It provides schema authoring, validation, planning, reconciliation, and diff - all running locally via the embedded Rust engine. No server, no API keys, no account required.

bash
pip install kanoniv
python
from kanoniv import Spec, Source, validate, plan, diff, reconcile

spec = Spec.from_file("customer-spec.yaml")
validate(spec).raise_on_error()

sources = [
    Source.from_csv("crm", "crm.csv"),
    Source.from_csv("billing", "billing.csv"),
]
result = reconcile(sources, spec)
print(f"Golden records: {len(result.golden_records)}")

System Requirements ​

RequirementVersion
Python3.9+
OSLinux, macOS, Windows

The core SDK has zero external dependencies beyond the bundled Rust engine (distributed as a prebuilt wheel).

Optional Dependencies ​

Some Source adapters use common data libraries. If you have them installed, they just work:

  • Source.from_pandas() / result.to_pandas() - needs pandas
  • Source.from_warehouse() / Source.from_dbt() - needs sqlalchemy + your database dialect (Databricks: databricks-sql-connector includes the dialect)

Supported Adapters ​

The adapter field in your identity schema YAML declares the source type. The Python SDK loads the actual data using Source.from_csv(), Source.from_pandas(), Source.from_warehouse(), or Source.from_dbt().

Local Adapters ​

AdapterSpec ValueSDK MethodUse Case
CSVadapter: csvSource.from_csv()Local files, prototyping
JSONadapter: jsonSource.from_json()JSON array files
pandasadapter: pandasSource.from_pandas()In-memory DataFrames

Warehouse Adapters ​

All warehouse sources use Source.from_warehouse(), which connects via SQLAlchemy. Install the appropriate dialect for your database.

AdapterSpec ValueConnection StringDialect Package
PostgreSQLadapter: postgrespostgresql://user:pass@host/dbpsycopg2
Snowflakeadapter: snowflakesnowflake://user:pass@account/dbsnowflake-sqlalchemy
BigQueryadapter: bigquerybigquery://project-id/datasetsqlalchemy-bigquery
Redshiftadapter: redshiftredshift://user:pass@cluster/dbsqlalchemy-redshift
Databricksadapter: databricksdatabricks://token:dapi...@host?http_path=...databricks-sql-connector

dbt Adapter ​

AdapterSpec ValueSDK MethodUse Case
dbtadapter: dbtSource.from_dbt()dbt model outputs

Example: Warehouse Source ​

yaml
sources:
  customers:
    adapter: snowflake
    location: ANALYTICS.CORE.CUSTOMERS
    primary_key: customer_id
    schema:
      email: { type: string, pii: true }
      phone: { type: string, pii: true }
      first_name: { type: string }
      last_name: { type: string }
python
from kanoniv import Source

source = Source.from_warehouse(
    "customers", "ANALYTICS.CORE.CUSTOMERS",
    connection_string="snowflake://user:pass@account/ANALYTICS",
    primary_key="customer_id",
)

Next Steps ​

Need real-time resolution, governance, or a persistent identity graph?

Kanoniv Cloud adds sub-millisecond resolution API, audit logs, overrides, PII masking, SSO, and more. Same SDK, same schema.

The identity and delegation layer for AI agents.