schemalock
A git-trackable lockfile for DataFrame schemas — like poetry.lock, but for schemas.
Detects unintended schema drift in data pipelines and requires deliberate, confirmed action to update. Works universally across pandas, PySpark (local), and PySpark on Databricks.
Install
pip install schemalock
# or, with local PySpark support:
pip install schemalock[spark]
Usage
from schemalock import lock, check, lock_update
# Create a lock file (fails if one already exists)
lock(df, name="customer_silver")
# Validate a dataframe's schema against the lock file
check(df, name="customer_silver") # raises SchemaDriftError on mismatch
# Deliberately update the lock file (interactive only)
lock_update(df, name="customer_silver")
How it works
schemalock computes a normalized schema for a pandas or PySpark DataFrame —
mapping engine-specific types (int64, LongType(), ...) into a shared
vocabulary (integer, float, string, timestamp, boolean, ...) — and
writes it to a JSON lock file under schemas/. Future runs of check()
compare the current schema against the lock file and raise SchemaDriftError
on any mismatch.
Lock files can only be created once (lock()), and can only be changed via
lock_update(), which requires an interactive TTY, a typed confirmation of
the schema name, and a non-empty reason.
License
MIT
Metadata
Release files for schemalock 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| schemalock-0.1.1.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schemalock-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / schemalock-0.1.1.tar.gz
| Download URL | schemalock-0.1.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b99419de5f9f97ea10e1ad5cd4466893f526ea826d43691e8f6a395ccb522ff
|
|
BLAKE2b-256 checksum How to use checksums |
003ee8cdf16471c3f3b34877783df8dff27c78e4ce6c0a9b04a3a177198c377a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Release files / schemalock-0.1.1-py3-none-any.whl
| Download URL | schemalock-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ff39f10aafd1bd35cfacbdbda3b960477656132ddd9321ea0a028ff8f1336c0
|
|
BLAKE2b-256 checksum How to use checksums |
929f66faee0a64fe3d858088d830d10720ae6de1006183da93262524fd32d8d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|