Skip to content

appcove/pgcmp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgcmp

A PostgreSQL schema comparison tool.

Installation

uv sync

Usage

Compare two PostgreSQL databases:

uv run python main.py <left_db> <right_db>

The left database is the "source" (what you want), and the right database is the "target" (what you have).

Examples

# Compare two databases
uv run python main.py "postgresql://user:pass@host1:5432/db1" "postgresql://user:pass@host2:5432/db2"

# Output as XML
uv run python main.py --xml "postgres://localhost/db1" "postgres://localhost/db2"

# Compare row counts only
uv run python main.py --row-counts "postgres://localhost/db1" "postgres://localhost/db2"

Options

Option Description
--xml Output results in XML format
--row-counts Compare row counts instead of schema

What It Compares

  • Schemas
  • Tables
  • Columns (type, nullability, defaults)
  • Views
  • Materialized views
  • Indexes
  • Constraints
  • Triggers
  • Functions

Exit Codes

Code Meaning
0 No differences found
1 Connection error
2 Differences found

About

postgresql comparer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages