Skip to main content
Documentation Status https://github.com/MacHu-GWU/sqlalchemy_upsert_kit-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/sqlalchemy_upsert_kit-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/sqlalchemy-upsert-kit.svg https://img.shields.io/pypi/l/sqlalchemy-upsert-kit.svg https://img.shields.io/pypi/pyversions/sqlalchemy-upsert-kit.svg https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to sqlalchemy_upsert_kit Documentation

https://sqlalchemy-upsert-kit.readthedocs.io/en/latest/_static/sqlalchemy_upsert_kit-logo.png

sqlalchemy_upsert_kit provides fast bulk upsert operations for SQLAlchemy applications, on SQLite, PostgreSQL and MySQL. It offers three strategies:

  • insert_or_ignore: insert new records, and leave existing rows alone.

  • insert_or_replace: insert new records, and overwrite existing rows with the records.

  • insert_or_merge: insert new records, and update only chosen columns of existing rows.

Each call loads the records into a temporary staging table and writes them with one native upsert statement (INSERT ... ON CONFLICT, or ON DUPLICATE KEY UPDATE on MySQL), typically 5-20x faster than row-by-row upserts on large batches, which suits ETL, data synchronization, and other bulk loads. Every call is atomic, and can run in its own transaction or inside yours.

Install

sqlalchemy_upsert_kit is released on PyPI, so all you need is to:

$ pip install sqlalchemy-upsert-kit

For PostgreSQL or MySQL, also install the driver, with the postgres or mysql extra:

$ pip install "sqlalchemy-upsert-kit[postgres]"
$ pip install "sqlalchemy-upsert-kit[mysql]"

To upgrade to latest version:

$ pip install --upgrade sqlalchemy-upsert-kit

Use with AI Coding Agents

This repo ships an Agent Skill that documents the public API of sqlalchemy_upsert_kit, so an AI coding agent such as Claude Code can use the library without reading its source. It lives in .claude/skills/pypi-sqlalchemy_upsert_kit. To use it in your project, copy it into your project’s .claude/skills/ folder. Run this from your project’s root:

$ git clone --depth 1 https://github.com/MacHu-GWU/sqlalchemy_upsert_kit-project.git /tmp/sqlalchemy_upsert_kit-project
$ mkdir -p .claude/skills
$ cp -R /tmp/sqlalchemy_upsert_kit-project/.claude/skills/pypi-sqlalchemy_upsert_kit .claude/skills/

Metadata

Release files for sqlalchemy_upsert_kit 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy_upsert_kit 0.3.1
File Size Uploaded Provenance Actions
sqlalchemy_upsert_kit-0.3.1.tar.gz 23.2 kB Without provenance Details for sqlalchemy_upsert_kit-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 59.0 kB

Release files / sqlalchemy_upsert_kit-0.3.1.tar.gz

Download URL sqlalchemy_upsert_kit-0.3.1.tar.gz
Size 23.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c2cca18b533eb824132692cfc618e820492598a9500fa847ea81d70b7304843c
BLAKE2b-256 checksum
How to use checksums
fc9349079fd0a010782a179b14393a99bd7e9592b639f3e92e4994569134a1ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sqlalchemy_upsert_kit-0.3.1-py3-none-any.whl

Download URL sqlalchemy_upsert_kit-0.3.1-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efacfde4196915752fda7711e1e261a0101103b1e6ee151398973ed0a2f2aab1
BLAKE2b-256 checksum
How to use checksums
33fc6a2a80973c41db8eb03f75188614ae8e1b139c20bd3879a4fdfe269d682a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for sqlalchemy_upsert_kit 0.3.1

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.

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