{"id":24492112,"url":"https://github.com/levkk/pg-logical-manager","last_synced_at":"2026-04-22T05:32:33.164Z","repository":{"id":57452150,"uuid":"230319329","full_name":"levkk/pg-logical-manager","owner":"levkk","description":"Manage PostgreSQL logical replication.","archived":false,"fork":false,"pushed_at":"2020-01-06T18:04:36.000Z","size":82,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-13T15:07:58.211Z","etag":null,"topics":["logical-replication","postgresql","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levkk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-26T19:44:55.000Z","updated_at":"2024-12-19T05:42:00.000Z","dependencies_parsed_at":"2022-09-19T16:20:37.933Z","dependency_job_id":null,"html_url":"https://github.com/levkk/pg-logical-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/levkk/pg-logical-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levkk%2Fpg-logical-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levkk%2Fpg-logical-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levkk%2Fpg-logical-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levkk%2Fpg-logical-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levkk","download_url":"https://codeload.github.com/levkk/pg-logical-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levkk%2Fpg-logical-manager/sbom","scorecard":{"id":586303,"data":{"date":"2025-08-11","repo":{"name":"github.com/levkk/pg-logical-manager","commit":"a94c97f494c35f78ba30701cde118f0151304772"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T20:36:12.393Z","repository_id":57452150,"created_at":"2025-08-20T20:36:12.393Z","updated_at":"2025-08-20T20:36:12.393Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32122716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logical-replication","postgresql","python3"],"created_at":"2025-01-21T18:45:02.351Z","updated_at":"2026-04-22T05:32:33.147Z","avatar_url":"https://github.com/levkk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/levkk/pg-logical-manager.svg?branch=master)](https://travis-ci.com/levkk/pg-logical-manager)\n\n# pg-logical-manager\nManage logical replication for your PostgreSQL cluster. Simply create/drop/enable/disable/list subscriptions.\n\nIncludes other more risky but interesting abilities like:\n1. rewinding subscriptions, i.e. moving back and forth between LSNs,\n2. creating reverse subscriptions, i.e. send data from replica to primary instead after replica promotion.\n\n[Pg Logical Manager Demo](https://i.imgur.com/bXpufEm.gif)\n\n## Setup\n\n## Pypi (production)\n\nSimply `pip install pglogicalmanager`.\n\n### Virtual environment (development)\n\n1. `pip install virtualenv`\n2. `virtualenv venv --python=python3`\n3. `source .venv/bin/activate`\n4. `pip install -e \".[dev]\"`\n\nWhen developing inside the virtual environment, use\n\n```bash\n$ python -m pglogicalmanager\n```\n\ninstead of\n\n```bash\n$ pglogicalmanager\n```\n\nfor all commands.\n\n### Configuration\n\n```bash\n$ pglogicalmanager --source=postgres://user:password@primary-db:5432/database --destination=postgres://user:password@replica-db:5432/database\n```\n\nThis will write a `.env` file in the same current folder. It will contain the DSNs above.\n\n### Make sure it works\n\n```bash\n$ pglogicalmanager list-subscriptions\n```\n\n## Usage\n\nCheck out the help menu:\n\n```bash\n$ pglogicalmanager --help\n```\n\n## Features\n\n### Basic features\n\nYou can easily list, create, drop, disable, and enable subscriptions. These sit directly on top of Postgres primitives (i.e. `CREATE SUBSCRIPTION`, `DROP SUBSCRIPTION`, etc.) and are fairly well-known. You can also list tables in source/destination and list columns in those tables.\n\n### Advanced (read risky) features\n\nLogical replication is powerful and flexible, and it allows you to do things binary replication can't do. Features we found useful and which are implemented here are:\n\n1. rewind subscription to specific LSN,\n2. reverse subscriptions,\n3. manually create/drop replication slots.\n\n#### Rewind subscription\n\nRewinding a subscription makes it replicate from a paritcular point-in-time. This works like `pg_rewind` except on a live cluster and without changing the WAL timeline. Note: _this is pretty dangerous_. If you rewind it to a wrong spot, you could create conflicts (unique contraint violations, for example) and the replication can break.\n\n```bash\n$ pglogicalmanager list-replication-origins\n$ pglogicalmanager rewind-replication-origin --help\n```\n\nTODO: Document use cases.\n\n#### Reverse subscription\n\nReversing a subscription is switching roles between the primary and the replica: the replica becomes the primary and the primary becomes the replica. This makes sense if you are promoting the replica to become the new primary and you want the old primary to be kept around for backup/rollback purposes. This is not as risky as rewinding, but it is irreverisble: once done, the replica must be the source for all writes, otherwise a split brain situation will be created.\n\n\n```bash\n$ pglogicalmanager reverse-subscription --help\n```\n\nThis will also overwrite your `.env` configuration and change the source DSN to the destination DSN and vice versa.\n\n#### Manually creating replication slots\n\nCreating replication slots is useful to tell your source (primary) to preserve WAL segments from the point of creation of the slot. The inheritent danger is running out of space on write-heavy systems, since WAL segments won't be cleaned up, and busy servers write a lot of WAL!\n\n```bash\n$ pglogicalmanager create-replication-slot test_slot\n```\n\nand see all current replication slots with\n\n```bash\n$ pglogicalmanager list-replication-slots\n```\n\nTODO: Document use cases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevkk%2Fpg-logical-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevkk%2Fpg-logical-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevkk%2Fpg-logical-manager/lists"}