Metadata-Version: 2.1
Name: dump-psql-roles-grants
Version: 0.2.2.dev2
Summary: Dump Postgres Roles and Grants
Home-page: https://github.com/rgeraskin/dump_psql_roles_grants
License: MIT
Keywords: postgres,psql,roles,grants,dump
Author: Roman Geraskin
Author-email: roman.n.geraskin@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: binary
Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: icecream (>=2.1.3,<3.0.0)
Requires-Dist: psycopg (>=3.1.18,<4.0.0)
Requires-Dist: psycopg-binary (>=3.1.18,<4.0.0) ; extra == "binary"
Requires-Dist: psycopg-infdate (>=1.0.3,<2.0.0)
Requires-Dist: pytablewriter (>=1.2.0,<2.0.0)
Requires-Dist: rich (>=13.7.1,<14.0.0)
Project-URL: Repository, https://github.com/rgeraskin/dump_psql_roles_grants
Description-Content-Type: text/markdown

# Dump Postgres Roles and Grants

## Install

You can choose

- plain python package `dump-psql-roles-grants` that requires `libpq` system library
- or package `dump-psql-roles-grants[binary]` that have binaries included

### pipx

```shell
pipx install 'dump-psql-roles-grants[binary]'
dump-psql-roles-grants --help
```

### pip

```shell
pip install 'dump-psql-roles-grants[binary]'
python -m dump_psql_roles_grants --help
```

### docker

```shell
docker pull rgeraskin/dump_psql_roles_grants
docker run --name dump_psql_roles_grants --rm rgeraskin/dump_psql_roles_grants --help
```

## Usage

1. Generate an example config file `dump_psql_roles_grants gen-example-config -o config.yaml`
1. Place instances connection info to `_inputs` dir

   ```shell
   _inputs/
   ├── dev.yaml
   ├── prod.yaml
   ├── stage.yaml
   └── test.yaml
   ```

   File format: yaml or json

   ```yaml
   <INSTANCE NAME 1>:
     dbname: <DB TO CONNECT>
     host: <INSTANCE HOSTNAME>
     password: <PASSWORD>
     user: <USER NAME>

   <INSTANCE NAME X>:
     dbname: <DB TO CONNECT>
     host: <INSTANCE HOSTNAME>
     password: <PASSWORD>
     user: <USER NAME>
   ```

1. Review `config.yaml`

1. Run

   ```shell
   dump_psql_roles_grants --help
   ```

