{"id":25887883,"url":"https://github.com/vendrinc/pg_parcel","last_synced_at":"2025-03-02T18:19:56.509Z","repository":{"id":37958882,"uuid":"465045813","full_name":"vendrinc/pg_parcel","owner":"vendrinc","description":"Extract horizontal slices of PostgreSQL schemas","archived":false,"fork":false,"pushed_at":"2024-10-02T03:13:54.000Z","size":9151,"stargazers_count":12,"open_issues_count":6,"forks_count":2,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-01-20T13:32:00.071Z","etag":null,"topics":["postgresql"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vendrinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-03-01T20:27:05.000Z","updated_at":"2024-08-26T21:53:21.000Z","dependencies_parsed_at":"2023-02-06T09:31:24.081Z","dependency_job_id":"203b7891-c4e7-4d85-97ba-6a358ab676ba","html_url":"https://github.com/vendrinc/pg_parcel","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendrinc%2Fpg_parcel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendrinc%2Fpg_parcel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendrinc%2Fpg_parcel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendrinc%2Fpg_parcel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vendrinc","download_url":"https://codeload.github.com/vendrinc/pg_parcel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241094243,"owners_count":19908647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["postgresql"],"created_at":"2025-03-02T18:19:55.860Z","updated_at":"2025-03-02T18:19:56.496Z","avatar_url":"https://github.com/vendrinc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_parcel\n\n[![CI](https://github.com/vendrinc/pg_parcel/actions/workflows/build.yml/badge.svg)](https://github.com/vendrinc/pg_parcel/actions/workflows/build.yml)\n[![Release](https://github.com/vendrinc/pg_parcel/actions/workflows/release.yml/badge.svg)](https://github.com/vendrinc/pg_parcel/actions/workflows/release.yml)\n\nA very minimal subset of `pg_dump --data-only` with multi-tenancy in mind. A solution to: https://postgrespro.com/list/thread-id/1715772\n\nMost options are specified via config file.\n\n```toml\ncolumn_name = \"customer_id\"\nschema_name = \"public\"\ndatabase_url = \"postgres://localhost:15432/postgres\"\nfeatures = [\"currency\", \"audit\"]\nskip_tables = [\n  \"_backup$\",\n  \"^obsolete_\"\n  # ... more regular expressions\n]\n\n[overrides]\n# We only want the one customer identified by --id on the command line\ncustomers = \"\"\"\n  select * from customers where id in :ids\n\"\"\"\n# The `user_files` table doesn't have a customer_id column, so we need to join.\nuser_files = \"\"\"\n  select user_files.*\n  from users_files\n  join users on users.id = user_files.user_id\n  where users.customer_id in :ids\n\"\"\"\ndaily_exchange_rates = \"\"\"\n  select * from daily_exchange_rates\n  where 'currency' = any (current_setting('pg_parcel.features')::text[])\n\"\"\"\naudit_log = \"\"\"\n  select * from audit_log\n  where customer_id in :ids and\n  (\n    ARRAY['audit'] \u0026\u0026 (current_setting('pg_parcel.features')::text[])\n    or created_at \u003e= NOW() - INTERVAL '30 days'\n    or updated_at \u003e= NOW() - INTERVAL '30 days'\n  );\n\"\"\"\n```\n\n\n| Session Variable                   | Contains                                                                                                                                                                                                       |\n| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `pg_parcel.ids`                    | The list of all values passed with `--id`                                                                                                                                                                      |\n| `pg_parcel.features`               | The list of features defined in the `pg_parcel.toml` file, minus any features turned off with `--no-feature`. If `--features` is set, they take precedence over the config file, but `--no-features` is final. |\n| `pg_partial.feature.`_`myfeature`_ | Same rules as `pg_parcel.features`, but one variable per setting. The value is just `true`                         Override queries can still use `IN :ids` but session variables are now preferred. |\n\n## Demo\n![screenshot](screenshots/demo.gif)\n\n## Releases\n\nWe publish binaries for both Linux x86_64 (any distro, using [musl](https://musl.libc.org/)) and macOS Universal (both Intel and Apple Silicon in a single binary).\n\nTo create a new release, update `Cargo.toml` and create a tag like `v1.2.3` (SemVer, prefixed with `v`).\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0\n  ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license\n  ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendrinc%2Fpg_parcel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvendrinc%2Fpg_parcel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendrinc%2Fpg_parcel/lists"}