sqlalchemy_upsert_kit
provides high-performance bulk upsert operations for SQLAlchemy applications using temporary table staging. It offers three optimized strategies: insert_or_ignore
for conflict-free insertion, insert_or_replace
for complete record replacement, and insert_or_merge
for selective column updates while preserving existing data. Each strategy leverages efficient SQL JOIN operations and temporary tables to achieve ~20x performance improvements over traditional row-by-row upserts, making it ideal for ETL processes, data synchronization, and bulk data operations where speed and reliability are critical.
sqlalchemy_upsert_kit
is released on PyPI, so all you need is to:
$ pip install sqlalchemy-upsert-kit
To upgrade to latest version:
$ pip install --upgrade sqlalchemy-upsert-kit