Skip to main content

No project description provided

Project description

test-badge coverage-badge

pypgsync

Python utility to sync two postgresql databases

Installation

pip install pypgsync

Usage

With the goal to synchronize a destination database to the state of a source database, whereas the source database grows in append-only fashion (no updates), the following steps can be run using pypgsync:

import psycopg
from pypgsync.pypgsync import sync

con_source = psycopg.connect(host="host_source", 
                             dbname="db_source", 
                             user="user_source", 
                             password="secret_source")
cur_source = con_source.cursor()

con_destination = psycopg.connect(host="host_destination", 
                                  dbname="db_destination", 
                                  user="user_destination", 
                                  password="secret_destination")

sync(cur_source, con_destination, tables=["table_a", "table_b", "table_c"], chunk_size=100)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypgsync-1.0.4.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

pypgsync-1.0.4-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page