Skip to main content

A collection of Python utility functions for ingesting data into SQLAlchemy-defined PostgreSQL tables, automatically migrating them as needed, and minimising locking

Project description

pg-bulk-ingest

PyPI package Test suite Code coverage

A Python utility function for ingesting data into SQLAlchemy-defined PostgreSQL tables, automatically migrating them as needed, allowing concurrent reads as much as possible.

Allowing concurrent writes is not an aim of pg-bulk-ingest. It is designed for use in ETL pipelines where PostgreSQL is used as a data warehouse, and the only writes to the table are from pg-bulk-ingest. It is assumed that there is only one pg-bulk-ingest running against a given table at any one time.

Features

pg-bulk-ingest exposes a single function as its API that:

  • Creates the tables if necessary
  • Migrates any existing tables if necessary, minimising locking
  • Ingests data in batches, where each batch is ingested in its own transaction
  • Handles "high-watermarking" to carry on from where a previous ingest finished or errored
  • Optionally performs an "upsert", matching rows on primary key
  • Optionally deletes all existing rows before ingestion
  • Optionally calls a callback just before each batch is visible to other database clients

Visit the pg-bulk-ingest documentation for usage instructions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pg_bulk_ingest-0.1.2.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pg_bulk_ingest-0.1.2-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file pg_bulk_ingest-0.1.2.tar.gz.

File metadata

  • Download URL: pg_bulk_ingest-0.1.2.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pg_bulk_ingest-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3a7bf0f8954483d529b99e51e100258fb4bb21baca68c5f7da92580a1dc86982
MD5 9d119b3de88d8d99c53201dee80fd2f1
BLAKE2b-256 001342b21ecd604aa9f1a239fac17fb08c65a5e72b8fda4b1d6633f4362cea22

See more details on using hashes here.

Provenance

The following attestation bundles were made for pg_bulk_ingest-0.1.2.tar.gz:

Publisher: deploy-package-to-pypi.yml on uktrade/pg-bulk-ingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pg_bulk_ingest-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pg_bulk_ingest-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pg_bulk_ingest-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc729ed4636846a41270cee22d4a2c2eb6c5ed96e715eb3eefc9cd3c3d13d83
MD5 2c31871b5241a79c27a3bc2e15ead954
BLAKE2b-256 5e174b006c391b1ea81d859803fe2c147dbb9ad6ff0418d34f4fcfff2e844d34

See more details on using hashes here.

Provenance

The following attestation bundles were made for pg_bulk_ingest-0.1.2-py3-none-any.whl:

Publisher: deploy-package-to-pypi.yml on uktrade/pg-bulk-ingest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page