Skip to main content

lakefreight

CI PyPI Python 3.11 | 3.12 | 3.13 | 3.14 License: MIT Code style: ruff

Bulk-move warehouse tables into open lakehouse files on cloud storage, so any engine can read them.

lakefreight unloads thousands of tables from a source warehouse into Parquet files on object storage, in a layout that Databricks, Snowflake, Redshift and BigQuery can all load or query. It plans the work from your metadata, keeps sensitive data in separate zones, and reconciles every extract before it is released.

It is built for the hard version of the job: thousands of tables, petabytes of data, many years of history, a fixed deadline, and a hand-off to storage owned by another cloud account in another region. The same method works for much smaller moves.

Support matrix

Supported today On the roadmap
Source Snowflake Other warehouses
Target storage Amazon S3 Google Cloud Storage, Azure Data Lake Storage
File format Parquet, with a manifest and schema sidecar per table
Table format Delta Lake or Apache Iceberg, registered over the same Parquet files without rewriting them Incremental re-registration after a re-extract
Readers Any engine that reads Parquet, Delta or Iceberg: Databricks, Snowflake, Redshift, BigQuery One-step registration in each engine's catalog
Orchestration AWS Step Functions

Status: alpha. SQL generation, chunk planning, zone routing, reconciliation rules and table registration are unit tested; registered Delta and Iceberg tables are read back with delta-rs, pyiceberg and DuckDB in the tests. The Snowflake and AWS execution path (control-table DDL, Lambda handlers, state machine) and reads from Spark or Databricks have not yet been run against live services.

What it does

lakefreight architecture: metadata drives a chunk planner and work items; Snowflake unloads Parquet into sensitivity zones; reconciled chunks get a manifest, are replicated to the target account, and are registered as Delta Lake or Iceberg tables

  • Discovers your tables. lakefreight discover reads sizes, columns and types from Snowflake, and flags personal data using Snowflake's own sensitive data classification plus any tags or column-name rules you add. Columns Snowflake has never classified are treated as sensitive.

  • Generates extract SQL from metadata. One COPY INTO per table, or per date chunk for large tables. Nothing is hand-written.

  • Routes by sensitivity. Three zones, each with its own stage, bucket location, key and role:

    • RESTRICTED: tables with tokenized identifiers, such as government ID numbers, that must leave in clear form
    • PII: tables with other personal data
    • INTERNAL: tables explicitly classified as non-sensitive

    Unknown classification is treated as sensitive.

  • Splits large tables into even chunks. Months are packed to a target size, and the predicates cover every possible value, including NULL dates.

  • Detokenizes restricted columns through a cross-reference table, with checks that the join neither drops nor duplicates rows.

  • Reconciles before release. A manifest is written only when the unloaded row count equals the source count; the receiving side loads only what has a manifest.

  • Restarts at chunk level. Every table or chunk is a tracked work item.

  • Registers open table formats. lakefreight register turns a table's unloaded files into a Delta Lake or Apache Iceberg table without rewriting them. Only files named in a committed manifest are included; it refuses incomplete tables, files still replicating, schema drift between chunks, and nanosecond timestamps that Spark and Iceberg v2 can't read.

Install

pip install lakefreight

Add the extra for the table format you want to register:

pip install "lakefreight[delta]"
pip install "lakefreight[iceberg]"

To read metadata straight from Snowflake, add the connector:

pip install "lakefreight[snowflake]"

Then create a settings file to edit, and run lakefreight --help for the commands:

lakefreight config --write

Typical workflow

  1. Discover the tables and their sensitivity. This uses a connection from ~/.snowflake/connections.toml; add --sql-only to get the query and run it yourself instead.

    lakefreight discover --database SALES --database HR --out metadata.csv
    
  2. Plan the work: one COPY INTO per table or date chunk, routed by zone.

    lakefreight plan --metadata metadata.csv --out generated
    
  3. Unload with the generated SQL, or at scale with the Step Functions pipeline.

  4. Register each table as Delta Lake or Iceberg once its chunks have landed.

    lakefreight register --format delta --table-root s3://my-egress/internal/SALES/PUBLIC/ORDERS
    

Try it in two minutes

No Snowflake or AWS account needed. Clone the repo for the sample data; this generates extract SQL for five sample tables from a fictional travel company:

git clone https://github.com/sidbhaumik/lakefreight.git
cd lakefreight && python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/lakefreight plan --metadata examples/metadata_sample.csv --profiles examples/profiles_sample.csv --out generated

Output:

5 tables -> 17 work items in generated/
  status: NEEDS_PROFILE 1, READY 16
  ready by zone: INTERNAL 1, PII 2, RESTRICTED 13
  note: TRAVEL.WEB.CLICK_EVENTS: chunk column EVENT_TS: confirm it prunes before using it
  note: TRAVEL.LEGACY.MISC_NOTES: table PII/RESTRICTED flag missing; treated as sensitive

Open generated/RESTRICTED/TRAVEL.BOOKINGS.RESERVATION/0002_202203_202204.sql to see an unload with the xref join and its two reconciliation queries.

To register a table's unloaded files as Delta Lake (Iceberg works the same way with --format iceberg, a catalog and a table name):

.venv/bin/lakefreight register --format delta --table-root s3://my-egress/internal/TRAVEL/BOOKINGS/RESERVATION

Run the tests:

.venv/bin/python -m pytest -q

Documentation

Document Read it when
Migration guide You have a migration like this to run and want the method, step by step
Design decisions You want to know why it is built this way, and what was rejected

Claude skill

The repo includes a Claude Code skill that drives the generator. Open the repo in Claude Code and ask, for example, "generate extract SQL for the tables in my_metadata.csv". Claude normalizes the file, runs the generator, and reports which tables need a decision.

Repository layout

Path Purpose
src/lakefreight/cli.py The lakefreight command
src/lakefreight/discover.py lakefreight discover: the metadata CSV from Snowflake's metadata and classification
src/lakefreight/generate.py lakefreight plan: metadata CSV in, SQL files out
src/lakefreight/chunk_planner.py Packs months into chunks with gap-free predicates
src/lakefreight/renderer.py Renders the unload, source-count and unmatched-token SQL
src/lakefreight/templates/copy_unload.sql.j2 The COPY INTO template
src/lakefreight/reconcile.py Pass/fail rules, manifest and schema sidecar
src/lakefreight/planning.py Creates work items in Snowflake from the control tables
src/lakefreight/handlers.py Lambda handlers: list, submit, poll, reconcile
src/lakefreight/register.py lakefreight register: Delta Lake or Iceberg metadata over the unloaded files
stepfunctions/extract_lane.asl.json State machine, one execution per lane
sql/ddl/ Control tables and the script that seeds them from metadata
src/lakefreight/defaults.toml Default settings: thresholds, zones, lanes, xref names. lakefreight config --write makes an editable copy
examples/ Sample metadata and month profiles
.claude/skills/ The Claude skill

Not included

  • Infrastructure as code: buckets, KMS keys, replication rules, stages, storage integrations, IAM, Lambda packaging.
  • A single-pass PARTITION BY unload for large tables with no date column.
  • Replication tracking, egress purge, and the delta pass for tables that change during the migration.
  • Adding a re-extracted chunk to a table that is already registered. Today, delete the table metadata and register again.

Contributing

See CONTRIBUTING.md. Changes are listed in CHANGELOG.md.

License

MIT

Metadata

Release files for lakefreight 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lakefreight 0.3.0
File Size Uploaded Provenance Actions
lakefreight-0.3.0.tar.gz 56.9 kB With provenance Details for lakefreight-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lakefreight 0.3.0
File Interpreter ABI Platform Actions
lakefreight-0.3.0-py3-none-any.whl Python 3 none any Details for lakefreight-0.3.0-py3-none-any.whl

Total release size: 92.2 kB

Release files / lakefreight-0.3.0.tar.gz

Download URL lakefreight-0.3.0.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f7af5323518724d482331928959707d2c82c669560cc19479cd2951f105410ea
BLAKE2b-256 checksum
How to use checksums
c763a1df72bea50796cc89bbe48fac613866e77195b118d4f46c6b2564255dc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / lakefreight-0.3.0-py3-none-any.whl

Download URL lakefreight-0.3.0-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea5024c208f6f48dfb520cee96991c5ea078bbc2bb1305b591e74200735da2d7
BLAKE2b-256 checksum
How to use checksums
9912d6e16941d11acf41b93a1699f8db0ca5779514e8704963efb92d48b1ec36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for lakefreight 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lakefreight-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page