$npx skillfedfor your agent

migra

Like `diff` but for PostgreSQL schemas

With conditionsPyPI DatabaseReleased Sep 2022246.9K downloads / moUnlicensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — migra-3.0.1663481299-py3-none-any.whl
v3.0.1663481299 · released 2022-09-18 · Python >=3.7,<4 · 3 runtime deps: sqlbag, six, schemainspect

Yes, if you work regularly with PostgreSQL schema migrations and want to reduce manual SQL writing. The low install friction and permissive license make it easy to try. However, the aging maintenance status (latest release 2022, though recent commits exist) means you should verify compatibility with your PostgreSQL version and be prepared to contribute fixes if needed. No known vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires PostgreSQL >= 9 and Python >= 3.7, < 4.
  • Both source and target databases must be accessible via connection strings.
  • Low install friction with only three runtime dependencies.

License · maintenance · safety

Unlicense (permissive) — Licensed under the Unlicense, a permissive public-domain-like license that places no restrictions on use, modification, or distribution.

last release 2022-09-18 (1426 days) · last repo commit 2025-08-25 · 3,051 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 246,944 downloads/mo, #8,703 on PyPI

Verify before relying

$ pip install migra
$ migra postgresql:///source_db postgresql:///target_db

Or in Python:
from migra import Migration
from sqlbag import connect
m = Migration(connect('postgresql:///a'), connect('postgresql:///b'))
print(m.sql)
  • Extent of PostgreSQL feature coverage beyond the 'most features' claim in the description
  • Performance characteristics when comparing large or complex schemas
  • Whether the aging maintenance status affects compatibility with recent PostgreSQL versions
Same gist for agents: .md · .json

What it is and what it does

migra is a schema diff tool for PostgreSQL that automatically detects differences between two database schemas and generates the SQL statements needed to transform one into the other. Instead of writing migrations by hand, you point migra at a source and target schema, and it figures out the alter statements required—column additions, constraint changes, and other modifications across most PostgreSQL features. It works both as a command-line tool and as a library you can call from Python scripts.

The tool is designed to make schema migrations less tedious and error-prone by automating the comparison and SQL generation. You can use it to synchronize a development database from application models, make schema changes testable, or simply understand what structural changes exist between two database versions. It requires PostgreSQL >= 9 and Python >= 3.7, with minimal dependencies (sqlbag, six, schemainspect).

Use it for

  • Generate migration scripts automatically when your application schema definition changes, reducing manual SQL writing.
  • Synchronize a development database schema with your application's ORM or schema models without hand-coding migrations.
  • Compare production and staging database schemas to identify drift and generate corrective SQL statements.
  • Test schema changes in a controlled way by generating and reviewing the exact SQL before applying it.
  • Audit schema differences between database versions or environments for compliance or debugging purposes.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you work regularly with PostgreSQL schema migrations and want to reduce manual SQL writing.

The low install friction and permissive license make it easy to try. However, the aging maintenance status (latest release 2022, though recent commits exist) means you should verify compatibility with your PostgreSQL version and be prepared to contribute fixes if needed. No known vulnerabilities.

Install

migra on PyPI

Before you install

Low install friction with only three runtime dependencies. Maintenance status is aging—the latest release was in 2022, though the repository remains active with recent commits and no archived status.

Requires PostgreSQL >= 9 and Python >= 3.7, < 4. Both source and target databases must be accessible via connection strings.

License in practice

Licensed under the Unlicense, a permissive public-domain-like license that places no restrictions on use, modification, or distribution.

Quickstart

$ pip install migra
$ migra postgresql:///source_db postgresql:///target_db

Or in Python:
from migra import Migration
from sqlbag import connect
m = Migration(connect('postgresql:///a'), connect('postgresql:///b'))
print(m.sql)

Verify before relying

  • Extent of PostgreSQL feature coverage beyond the 'most features' claim in the description
  • Performance characteristics when comparing large or complex schemas
  • Whether the aging maintenance status affects compatibility with recent PostgreSQL versions

Package facts

LicenseUnlicense permissive
Python supportSupports the current Python release >=3.7,<4
Install frictionLow. Pure-Python wheel
Runtime dependencies
3 packages
sqlbagsixschemainspect
MaintenanceAging 1,426 days since the last release
Last repo commit
First released
Downloads246,944 / month, #8,703 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: migra-3.0.1663481299-py3-none-any.whl

Tags

Capabilities
postgres schema diffdatabase migration generatorpostgresql schema comparisonauto-generate sql migrationsschema synchronization tooldatabase schema versioningpostgres schema changes
Topics
schema-migrationpostgres-toolssql-generation

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 › “postgres schema diff”

  • migramigra compares PostgreSQL database schemas and generates the SQL…
  • sqlalchemy-diffCompares database schemas across two SQLAlchemy-connected databases,…
  • tentaclio-postgresBundles PostgreSQL connectivity and schema support for the tentaclio…

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

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.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

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.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

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.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

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.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

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.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also django-pg-zero-downtime-migrations · sqlalchemy-diff · alembic · schemachange · atlas-provider-sqlalchemy · squawk-cli · schemainspect · yoyo-migrations · alembic-autogenerate-enums · alembic-postgresql-enum