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.
pip install kanonivfrom 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
| Requirement | Version |
|---|---|
| Python | 3.9+ |
| OS | Linux, 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()- needspandasSource.from_warehouse()/Source.from_dbt()- needssqlalchemy+ your database dialect (Databricks:databricks-sql-connectorincludes 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
| Adapter | Spec Value | SDK Method | Use Case |
|---|---|---|---|
| CSV | adapter: csv | Source.from_csv() | Local files, prototyping |
| JSON | adapter: json | Source.from_json() | JSON array files |
| pandas | adapter: pandas | Source.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.
| Adapter | Spec Value | Connection String | Dialect Package |
|---|---|---|---|
| PostgreSQL | adapter: postgres | postgresql://user:pass@host/db | psycopg2 |
| Snowflake | adapter: snowflake | snowflake://user:pass@account/db | snowflake-sqlalchemy |
| BigQuery | adapter: bigquery | bigquery://project-id/dataset | sqlalchemy-bigquery |
| Redshift | adapter: redshift | redshift://user:pass@cluster/db | sqlalchemy-redshift |
| Databricks | adapter: databricks | databricks://token:dapi...@host?http_path=... | databricks-sql-connector |
dbt Adapter
| Adapter | Spec Value | SDK Method | Use Case |
|---|---|---|---|
| dbt | adapter: dbt | Source.from_dbt() | dbt model outputs |
Example: Warehouse Source
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 }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
- Local Quickstart: Write your first schema and reconcile data
- Cloud Quickstart: Auto-discover and reconcile from the CLI
- Identity Schema Configuration: Full schema configuration options
- Source Adapters: Detailed adapter documentation
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.
