Skip to main content

A declarative, contract-driven medallion pipeline engine for data mesh architectures. Write once. Run on Spark, Polars, or DuckDB.

Project description

LakeLogic

Define data trust once. Enforce it from development to production.

Documentation PyPI CI codecov Python License

LakeLogic is an open-source framework for executable data contracts. Describe a data product's schema, quality rules, PII handling, lineage, and materialization in YAML, then run that contract with Polars, DuckDB, or Spark.

Use the same contract to get fast feedback locally, check changes in CI/CD, and govern pipeline execution in your lakehouse. Records that fail row-level rules can be retained with their failure reasons instead of being silently discarded.

Run the five-minute Colab quickstart · Read the documentation · Browse the examples

LakeLogic Architecture

Project status: LakeLogic is currently beta software. Test contracts and engine-specific behaviour against representative data before production adoption.

The Problem It Solves

Data teams repeatedly rebuild the same controls in notebooks and pipelines:

  • schema checks and business rules;
  • accepted and quarantined outputs;
  • PII handling and lineage metadata;
  • incremental processing and materialization;
  • deployment checks for contract changes.

LakeLogic puts those expectations in a version-controlled contract and provides the execution machinery around it. Business meaning stays visible in YAML; complex transformations can remain in normal, testable Python or SQL.

Quick Start

Install the base package:

pip install lakelogic

The fastest complete introduction is the Google Colab quickstart. It creates sample data, executes a contract, and shows accepted and quarantined records without requiring a local Spark environment.

A contract starts with the fields and rules that matter to the data product:

version: 1.0.0
dataset: orders

info:
  title: E-Commerce Orders
  owner: data-team@company.com
  target_layer: silver

model:
  fields:
    - name: order_id
      type: integer
      required: true
    - name: customer_email
      type: string
      required: true
      pii: true
      masking: partial
    - name: amount
      type: float
      required: true

quality:
  row_rules:
    - name: valid_email
      sql: "customer_email LIKE '%@%.%'"
    - name: positive_amount
      sql: "amount > 0"

Run it through the Python API:

from lakelogic import DataProcessor

processor = DataProcessor("orders_contract.yaml", engine="polars")
result = processor.run_source("orders.csv")

print(f"Accepted: {result.good_count}")
print(f"Quarantined: {result.bad_count}")
print(f"Quality score: {result.quality_score:.1f}")

For a validation run, LakeLogic returns the accepted and quarantined rows with counts and diagnostic context. Materialization, alerts, retention, and catalog behaviour depend on the contract, selected engine, and connected infrastructure.

To check a contract before deployment:

lakelogic validate \
  --contract orders_contract.yaml \
  --gates breaking_change,pii_classification,lineage_break

CI gates analyse contract declarations and the comparison context supplied to them. Add the command to your pull-request workflow to reject a change when a configured gate fails.

Core Capabilities

Capability What LakeLogic provides
Executable contracts Strictly parsed YAML for schemas, row rules, dataset rules, service levels, lineage, and materialization.
Quality and quarantine Accepted and failed records, rule-level diagnostics, run counts, and quality scores.
Contract checks in CI/CD Static gates for breaking schema changes, PII declarations, and lineage changes when the required comparison context is available.
Multiple execution engines A common contract model across Polars, DuckDB, and Spark, with documented engine-specific boundaries.
Lakehouse patterns Incremental processing, Delta or Iceberg outputs, merge strategies, SCD Type 2, dependencies, and external transformation logic.
Operational evidence Structured run logs, execution metadata, lineage evidence, and optional notification integrations.

See the complete capability matrix before choosing an engine or storage format.

Engine Support

Engine Best suited to Installation and boundaries
Polars Local development, notebooks, CI, and fast single-node processing Included in the base package. Delta support uses delta-rs.
DuckDB Local analytical SQL and embedded workflows Included in the base package. Some catalog and materialization combinations differ from Spark.
Spark Distributed lakehouse workloads and managed catalogs such as Unity Catalog Install with pip install "lakelogic[spark]". Managed catalog features depend on the Spark platform and its configuration.

The contract model is shared, but engines are not identical. Review engine and format capabilities for supported combinations.

Where Data Mesh Fits

LakeLogic can provide shared contract machinery for a data mesh while domain teams retain ownership of business meaning.

Data-mesh principle LakeLogic's role
Domain ownership Domain teams version contracts alongside the data products they own.
Data as a product Contracts make schemas, rules, service expectations, and dependencies explicit.
Self-service platform Teams reuse common validation and execution interfaces across supported engines.
Federated governance Platform standards can be expressed as shared defaults and checked alongside domain-specific rules.

LakeLogic does not create organisational ownership, access policies, alert delivery, or regulatory compliance by itself. It supplies contract declarations, runtime controls, and evidence that can participate in those wider systems.

Learn by Doing

Guide Use it to explore
Quickstart Your first contract, generated data, validation, and quarantine.
Data Quality and Trust Schema rules, business rules, reconciliation, and medallion flows.
Compliance and Governance PII-handling and governance patterns that must be combined with organisational controls.
Engine and Scale Polars, DuckDB, Spark, incremental execution, and dimensional modelling.
Developer Experience Validation, diagnostics, CI/CD, and development workflows.
Data Generation and AI Synthetic test data and optional AI-assisted workflows.
Integrations dbt, dlt, databases, streaming sources, and notifications.

Documentation

Contributing

Contributions and issue reports are welcome. See CONTRIBUTING.md for the development workflow and developer installation for environment setup.

License

LakeLogic is available under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lakelogic-1.41.0.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lakelogic-1.41.0-py3-none-any.whl (726.3 kB view details)

Uploaded Python 3

File details

Details for the file lakelogic-1.41.0.tar.gz.

File metadata

  • Download URL: lakelogic-1.41.0.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lakelogic-1.41.0.tar.gz
Algorithm Hash digest
SHA256 1f0e489372649b1a0e90837269d0e69df0e8fbdf6af9ee8e8efc21df9ce96ba9
MD5 ce1a73b6352c8379c1b8eb1d6f4479c9
BLAKE2b-256 0164d40fb425b80b941b7a79943d6b9f271a0af6c440200fc09c7d797ac1263c

See more details on using hashes here.

File details

Details for the file lakelogic-1.41.0-py3-none-any.whl.

File metadata

  • Download URL: lakelogic-1.41.0-py3-none-any.whl
  • Upload date:
  • Size: 726.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lakelogic-1.41.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef996b55d1823187bea7c243e8a7f2281a0a5d79a2aecc9ff7e4e0bedd423f51
MD5 9cdba13ceac9e589d18dfd0ae4b961f4
BLAKE2b-256 57bff7c90566d2a783b8a3a9a66c30109b71d899f2436e07775b196d865102dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page