Skip to main content

Pumping base classes

Allows fetching external data via API and store it in database. Supports full and partial modes.

See pumpe/pumps/model_test.py for example.

Datetimes

Datetime fields are timezone-aware and stored in UTC (SQLModel's UTCDateTime). Pass aware values to datetime fields: they are normalized to UTC, and naive values are rejected when written. Annotate a field with pydantic's NaiveDatetime to store naive values as they are. pumpe's own timestamps keep microseconds on MySQL/MariaDB too (DATETIME(6), via PreciseUTCDateTime). _fetch receives modified_since and created_after as aware UTC datetimes.

Primary keys

Source records must carry the model's primary key, and rows are matched by it as Python values. If the source can send string keys that differ only in case, accents or trailing spaces, give the key column a binary collation (MySQL/MariaDB compare strings case-insensitively by default). Otherwise such records fail the run: with ValueError when a stored key matches a source key only under the collation, or with the database's IntegrityError when two such spellings arrive in one batch.

Concurrent runs

One run of a pump writes at a time, across sessions and processes: a run takes a lease in the pump_lock table, and run() returns None while another run holds it. Every write transaction renews the lease, and a run that loses it fails before writing anything more. A lease older than lease_timeout (a class attribute, 10 minutes by default) is taken over, so keep it above the longest time a run spends between two renewals: waiting for the next batch of _fetch plus writing a batch. A competing run that finds the lease expired while its holder is still writing waits for the database's lock timeout, then skips on PostgreSQL and MySQL/MariaDB. SQLite locks the whole database for a write, so there it cannot tell that holder from any other writer and raises database is locked instead.

Running

start_pump(pump_task) runs the task until it finishes or the process gets SIGINT or SIGTERM, and meanwhile serves GET /health on 0.0.0.0:8000. Pass health_host and health_port to listen elsewhere, or health_port=None to serve nothing.

Metadata

Release files for pumpe 0.8.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 pumpe 0.8.0
File Size Uploaded
pumpe-0.8.0.tar.gz 13.7 kB Details

Built distribution (wheel)

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

Total release size: 27.8 kB

Release files / pumpe-0.8.0.tar.gz

Download URL pumpe-0.8.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
58a14d9fc94642594511110f9b69187fdc3b50dc0ea341e99bb17f260970b993
BLAKE2b-256 checksum
How to use checksums
7b58edcabf3c6e555cd2d39dbf58df2bbab7d06b38989761fb11494ad17a0b14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pumpe-0.8.0-py3-none-any.whl

Download URL pumpe-0.8.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85bae5ec3ddee4bab3bfded8a8e20456c3b1f7c2f0d0cfa699d01b61979b4316
BLAKE2b-256 checksum
How to use checksums
7d5c81240b64ba772a9da52f42764d9d1ede1271ce00fc9ef194f0c046b7d47a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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