--- id: pangres version: "4.2.1" license: The Unlicense license_treatment: permissive maintenance: dormant --- # pangres — Postgres insert update with pandas DataFrames. License: permissive · Maintenance: dormant · Downloads: 130.2K/mo ## 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 above — verify before relying. Upserts pandas DataFrames into PostgreSQL, MySQL, and SQLite databases using primary or unique keys, with optional automatic table and schema creation. 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 pip install pangres uv add pangres poetry add pangres ## Installing pangres 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. 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') 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. 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: unspecified - Install friction: high - Maintenance: dormant - Downloads: 130.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pandas dataframe upsert sql, insert on conflict update, bulk insert pandas database, dataframe to sql with upsert, postgres mysql sqlite upsert, automatic table creation sql, json column pandas sql, pandas-sql-integration, upsert-operations, async-database [View on SkillFed](https://skillfed.io/packages/pangres) · [View on PyPI](https://pypi.org/project/pangres/)