No project description provided
Project description
PgPipe
PgPipe is a Python package designed to efficiently synchronize data between two PostgreSQL databases. It is specifically designed to handle large amounts of data by dividing the transfer process into smaller, manageable chunks.
Features
- Efficient data transfer using the COPY command
- Divide data into smaller chunks for improved performance
- Track transfer progress and allow restarting from checkpoints
- Handle foreign key dependencies by ensuring the correct order of table transfers
Installation
To install PgPipe, simply use pip:
pip install pgpipe
Usage
The PgPipe tool provides a command line interface (CLI) for synchronizing data between two PostgreSQL databases. The following sections will guide you on how to use this tool effectively.
Setting up the CLI
PgPipe requires you to specify several settings to connect to your PostgreSQL databases and define the synchronization parameters. These settings can be provided through command line arguments or environment variables. Here is the list of command line arguments you can use:
--log-level: Set the log level. Default is 'INFO'.--schemas: Specify the list of schemas. Default is 'public'.--chunk-size-offset: Set the chunk size for offset-based chunking. Default is 50000.--chunk-size-timedelta: Set the chunk size for time-range-based chunking in days. Default is 1.--db-schema-path: Specify the path to the DB schema file. Default is './db_schema.json'.--chunk-data-path: Specify the path to the chunk data file. Default is './chunk_data.json'.--source-dsn: Specify the source database DSN. If not set, it is read from the environment variable 'PGPIPE_SOURCE_DSN'.--destination-dsn: Specify the destination database DSN. If not set, it is read from the environment variable 'PGPIPE_DESTINATION_DSN'.
Running the Synchronization Steps
The synchronization process is divided into three steps, each corresponding to a command:
- Create Database Schema: To execute this step, run the
create_db_schemacommand. This will read the source database metadata and store it in the DB schema file specified by--db-schema-path.
pgpipe create_db_schema --source-dsn="your_source_dsn" --db-schema-path="your_db_schema_path"
- Prepare Chunks: Run the
prepare_chunkscommand to prepare chunk metadata for data transfer. The metadata will be saved to the chunk data file specified by--chunk-data-path.
pgpipe prepare_chunks --source-dsn="your_source_dsn" --db-schema-path="your_db_schema_path" --chunk-data-path="your_chunk_data_path" --chunk-size-offset=50000 --chunk-size-timedelta=1
- Transfer Data: The
transfer_datacommand starts the data transfer process, using the prepared metadata to guide the process.
pgpipe transfer_data --source-dsn="your_source_dsn" --destination-dsn="your_destination_dsn" --chunk-data-path="your_chunk_data_path"
If no command is specified, the CLI will print a help message with a list of available commands and settings.
License
PgPipe is released under the MIT License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgpipe-1.0.5.tar.gz.
File metadata
- Download URL: pgpipe-1.0.5.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf81b0a95d205bc3e51a89963058c098cbddd2adcc638d121ef832e33fde7700
|
|
| MD5 |
95e88842ca5fe59311a6c850a74ac333
|
|
| BLAKE2b-256 |
b4a2c0fbbfc9dbf552f391a5a9ddc97e612d516f85dfbe1c3ffa482cef682928
|
File details
Details for the file pgpipe-1.0.5-py3-none-any.whl.
File metadata
- Download URL: pgpipe-1.0.5-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
396039494b7136fb2809ae49c9bfa2e317d1bc00f8fd4452dc0673f0831c2026
|
|
| MD5 |
dd38f802b6e1505777ba2738e897fe27
|
|
| BLAKE2b-256 |
74499138a1aa63f977b4b7c0d399fa4cbd48b8291a2174589ad13e82cd8e6104
|