Skip to main content

lakemigrate

PyPI Python License: MIT CI

Ordered SQL migrations with a version table for Delta lakehouse storage.

lakemigrate discovers SQL files in a directory, applies any that have not yet run — in version order — and records each in a Delta history table. Checksums guard against silent edits after a migration has been applied.

Installation

Managed Spark environment (Databricks, EMR, GCP Dataproc — Spark is already present):

pip install lakemigrate

Local development (installs PySpark and delta-spark):

pip install "lakemigrate[spark]"

Migration files

Name each file NNN__description.sql where NNN is a zero-padded three-digit version number:

migrations/
  001__create_events_table.sql
  002__add_user_id_column.sql
  003__backfill_legacy_data.sql

Files are applied in version order. Once applied, the file content is checksummed — modifying a file after it runs raises ChecksumMismatchError.

CLI

# apply all pending migrations
lakemigrate migrate --migrations-dir migrations/

# custom history table
lakemigrate migrate --migrations-dir migrations/ --history-table mydb.schema_history

Python API

from lakemigrate import migrate

# uses default history table: default.lakemigrate_history
migrate("migrations/")

# custom history table
migrate("migrations/", history_table="mydb.schema_history")

A SparkSession must be active before calling migrate. The history table is created automatically on first run.

Error handling

Exception When
InvalidFilenameError A file does not match NNN__description.sql
DuplicateVersionError Two files share the same version number
ChecksumMismatchError An applied migration file has been modified

All exceptions inherit from LakeMigrateError.

Links

Metadata

Release files for lakemigrate 0.1.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 lakemigrate 0.1.0
File Size Uploaded
lakemigrate-0.1.0.tar.gz 32.0 kB Details

Built distribution (wheel)

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

Total release size: 40.4 kB

Release files / lakemigrate-0.1.0.tar.gz

Download URL lakemigrate-0.1.0.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7ae57e2fba704627aab958ac8bb9b6916d20e1956fdaeccfcada9a2abf54083d
BLAKE2b-256 checksum
How to use checksums
d76636b9c0d5fac206df8aaa9880f3ca9ced7106441cc9d2fabea75f1d925934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 4, 2026.

Transparency log

Release files / lakemigrate-0.1.0-py3-none-any.whl

Download URL lakemigrate-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a72fbac0d6f47992198b5da10a7e5a76a14977c7d708e490d18e68cae999059d
BLAKE2b-256 checksum
How to use checksums
f851a889b8457fec57d54dcb5d4dc61821b76bc93911472cf442468fd189a180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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