pangres
Postgres insert update with pandas DataFrames.
Decision gist · record as of 2026-08-14
Yes, if you are locked into an older dependency ecosystem and need upsert semantics for pandas DataFrames. No, if you require active maintenance or compatibility with the latest sqlalchemy/alembic versions—the package is dormant and may break with dependency updates. Consider alternatives if you need ongoing support or are starting a new project.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- SQLite must be version 3.24.4 or higher for UPSERT syntax.
- For async support, Python>=3.8 required.
- Database-specific drivers (psycopg2, pymysql, asyncpg, aiomysql, aiosqlite) must be installed separately.
License · maintenance · safety
The Unlicense (permissive) — Licensed under The Unlicense (permissive public domain), imposing no restrictions on use, modification, or redistribution.
last release 2023-11-05 (1013 days) · last repo commit 2023-12-06 · 233 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 130,215 downloads/mo, #11,650 on PyPI
Alternatives
Verify before relying
pip install pangres pandas sqlalchemy
import pandas as pd
from sqlalchemy import create_engine
from pangres import upsert
df = pd.DataFrame({'id': [1], 'name': ['test']})
engine = create_engine('sqlite:///test.db')
upsert(engine, df, 'my_table')- Whether the package works reliably with modern versions of sqlalchemy and alembic given the dormant maintenance status.
- Current compatibility with Python 3.10 and 3.11 in practice, despite classifiers listing them.
- Performance characteristics on large datasets relative to alternatives.
What it is and what it does
Pangres bridges pandas DataFrames and SQL databases by implementing upsert operations (insert-or-update) that pandas' native to_sql does not support. It works with PostgreSQL, MySQL, and SQLite, handling ON CONFLICT DO NOTHING and ON CONFLICT DO UPDATE semantics based on primary or unique keys. The package can automatically create missing tables and schemas, add new columns to existing tables, and alter column types when safe—features that simplify data pipeline workflows where you need idempotent writes without manual schema management.
The library includes optional JSON column support, SQL injection protection through parameterized queries, and asynchronous engine support for async/await patterns. It depends on pandas, sqlalchemy, alembic, and packaging. However, the package has been dormant for over 1000 days; the last release was in November 2023 and the last commit in December 2023, raising questions about ongoing maintenance and compatibility with current dependency versions.
Use it for
- Incrementally load data from pandas into a production database without duplicating rows or manually managing upsert logic.
- Automatically create and evolve SQL table schemas from DataFrame structure without writing DDL.
- Build data pipelines that idempotently write results to PostgreSQL, MySQL, or SQLite using the same code.
- Insert JSON objects (dicts, lists) into existing JSON columns in PostgreSQL, which pandas to_sql does not support.
- Async-first applications that need to upsert DataFrames without blocking, using aiosqlite, asyncpg, or aiomysql.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are locked into an older dependency ecosystem and need upsert semantics for pandas DataFrames.
No, if you require active maintenance or compatibility with the latest sqlalchemy/alembic versions—the package is dormant and may break with dependency updates. Consider alternatives if you need ongoing support or are starting a new project.
Install
pangres on PyPI
Before you install
High install friction due to 4 runtime dependencies (pandas, sqlalchemy, alembic, packaging). Package is dormant—last release was 1013 days ago with no recent commits. For sqlalchemy>=2.0 compatibility, requires alembic>=1.7.2 and pandas>=1.4.0; asynchronous support requires Python>=3.8.
SQLite must be version 3.24.4 or higher for UPSERT syntax. For async support, Python>=3.8 required. Database-specific drivers (psycopg2, pymysql, asyncpg, aiomysql, aiosqlite) must be installed separately.
License in practice
Licensed under The Unlicense (permissive public domain), imposing no restrictions on use, modification, or redistribution.
Quickstart
pip install pangres pandas sqlalchemy
import pandas as pd
from sqlalchemy import create_engine
from pangres import upsert
df = pd.DataFrame({'id': [1], 'name': ['test']})
engine = create_engine('sqlite:///test.db')
upsert(engine, df, 'my_table')
Verify before relying
- Whether the package works reliably with modern versions of sqlalchemy and alembic given the dormant maintenance status.
- Current compatibility with Python 3.10 and 3.11 in practice, despite classifiers listing them.
- Performance characteristics on large datasets relative to alternatives.
Package facts
| License | The Unlicense permissive |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | 4 packagespandassqlalchemyalembicpackaging |
| Maintenance | Dormant 1,013 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 130,215 / month, #11,650 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: Public DomainOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: pangres-4.2.1.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pandas dataframe upsert sql”
- pangresUpserts pandas DataFrames into PostgreSQL, MySQL, and SQLite…
- pandasqlpandasql lets you query pandas DataFrames using SQL syntax instead of…
- pandas-gbqpandas-gbq reads data from Google BigQuery into pandas DataFrames and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also connectorx · SQLAlchemy-JSONField · pysqlsync · ipython-sql · qpd · django-postgres-extra · fastlite · pandasql · ddlparse · beam-nuggets