Metadata-Version: 2.1
Name: pypgsync
Version: 1.0.4
Summary: 
Home-page: https://github.com/danielschweigert/pypgsync
Author: Daniel Schweigert
Author-email: dan.schweigert@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: coverage-badge (>=1.1.0,<2.0.0)
Requires-Dist: psycopg (>=3.1.2,<4.0.0)
Requires-Dist: pytest-cov (>=3.0.0,<4.0.0)
Project-URL: Repository, https://github.com/danielschweigert/pypgsync
Description-Content-Type: text/markdown

![test-badge](https://github.com/danielschweigert/pypgsync/actions/workflows/lint-and-test.yml/badge.svg)
![coverage-badge](https://raw.githubusercontent.com/danielschweigert/pypgsync/main/coverage-manual.svg)

# pypgsync
Python utility to sync two postgresql databases


## Installation

```bash
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:
```python
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)
```
