loadmark
A safe bookmark (checkpoint) for incremental data loads.
Incremental loading means "fetch only what changed since last time". loadmark remembers
"since when" for you, and it follows three rules that are easy to get wrong by hand:
- The bookmark moves only when a run succeeds. A crash never loses data.
- It uses the run's start time, with an optional lookback (for example, back to midnight), so late-arriving records are not missed.
- Every run is recorded (run id, start, end, status, load type, rows), like an audit table.
No dependencies. Python 3.9+.
Install
pip install loadmark
Quick start
from loadmark import Checkpoint, SQLiteStore, dedupe_latest
cp = Checkpoint(
name="crm/contacts", # one name per source/object
store=SQLiteStore("audit.db"), # where the history is kept
lookback="start_of_day", # re-read from midnight of the last good run
)
with cp.run() as run:
rows = fetch_from_api(since=run.since) # run.since is None on the first run (full load)
rows = dedupe_latest(rows, key="id", order_by="updated_at")
write_to_s3(rows)
run.rows = len(rows)
# leaving the block normally -> run is saved as SUCCESS and the bookmark moves
# an exception inside the block -> run is saved as FAILED and the bookmark stays
Why a lookback?
Records can arrive late, and a job can start a little before the source finishes writing.
A lookback re-reads a small overlap so nothing is missed. The price is duplicates, so always
deduplicate by key afterwards (dedupe_latest, or a MERGE in your database).
| lookback | meaning |
|---|---|
None |
start exactly at the last successful run's start time |
"start_of_day" |
midnight of that day, in the time zone you set with tz="Asia/Kolkata" |
"30m", "2h", "1d", "1w" |
go back that much |
Features
cp.run()- start a run (context manager)cp.run(since="2026-09-01")- manual backfill from a datecp.next_since()- see where the next run would startcp.history(limit=10)- latest runs, newest firstcp.reset()- forget history, next run is a full load- Run lock: a second run of the same name is refused (
RunInProgressError) while one is running. A run stuck as RUNNING for more thanstale_after(default 6 hours) is marked FAILED automatically. - Stores:
LocalFileStore(JSON file),SQLiteStore, or write your own.
Use your own database (Snowflake, Postgres, ...)
Subclass Store and implement five methods: save, last_success, running, history, clear.
from loadmark import Store
class MyWarehouseStore(Store):
... # run SQL against your own audit table
Limits (honest list)
- The run lock is a status check, not a database-level lock. For many parallel workers, use a store with real transactions.
- It remembers when your job ran, not the highest
updated_atseen in the data. - It does not fetch or write data. It only manages the bookmark.
Develop
pip install -e ".[dev]"
pytest
python examples/basic_usage.py
License
MIT
Metadata
Release files for loadmark 0.1.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 | |
|---|---|---|---|---|
| loadmark-0.1.0.tar.gz | 13.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loadmark-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.6 kB
Release files / loadmark-0.1.0.tar.gz
| Download URL | loadmark-0.1.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e7fc76a1aa9d7fb9ba3dc43f1d190f646179d2f530cb1c8bba4fcbb18a3c890
|
|
BLAKE2b-256 checksum How to use checksums |
0d1a9b890f6ed5109cb19b89afae4f629729da0a5196bff5543a1ae9bf1ce0ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / loadmark-0.1.0-py3-none-any.whl
| Download URL | loadmark-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
056f002e8fea7220e66a082fadea1b5dbd276a5db1fe63dbc5357957d6e41bd9
|
|
BLAKE2b-256 checksum How to use checksums |
daf573fe92e70a35eede93ae8bec76228f6981a004ca259e554b3479da6e5404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for loadmark 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.