lakefreight
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
-
Generates extract SQL from metadata. One
COPY INTOper 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 formPII: tables with other personal dataINTERNAL: 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 registerturns 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]"
Then create a settings file to edit, and run lakefreight --help for the commands:
lakefreight config --write
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/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 BYunload 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
Metadata
Release files for lakefreight 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lakefreight-0.2.0.tar.gz | 48.3 kB | With provenance | Details for lakefreight-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lakefreight-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for lakefreight-0.2.0-py3-none-any.whl |
Total release size: 77.8 kB
Release files / lakefreight-0.2.0.tar.gz
| Download URL | lakefreight-0.2.0.tar.gz |
|---|---|
| Size | 48.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f76fc9f60ab2cda7f4581e5de84e28978672fd09f94739b59bf9b4d7091585f
|
|
BLAKE2b-256 checksum How to use checksums |
5844c6ebdf49d07a28b38244d7b12dc802b6b9646ffb09cf8ccbab0d2f4a6a10
|
| 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 logRelease files / lakefreight-0.2.0-py3-none-any.whl
| Download URL | lakefreight-0.2.0-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65e38dfa5ed37516a91dbc5aa3aa71ed49481e08b1a5fc8b4e42d1f137177aaf
|
|
BLAKE2b-256 checksum How to use checksums |
97d9beacb16cbe0a308a806d38798059651d4c250fc36066a03898fc6dbee78c
|
| 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 logSecurity for lakefreight 0.2.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.
Attestation for lakefreight-0.2.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 logA 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.