Metadata-Version: 2.4
Name: pgdumplib
Version: 4.0.0
Summary: Python3 library for working with pg_dump files
Project-URL: Homepage, https://github.com/gmr/pgdumplib
Author-email: "Gavin M. Roy" <gavinmroy@gmail.com>
License: BSD 3-Clause License
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: SQL
Classifier: Topic :: Database
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: pendulum
Requires-Dist: toposort
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: coverage; extra == 'dev'
Requires-Dist: faker; extra == 'dev'
Requires-Dist: maya; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: psycopg; extra == 'dev'
Requires-Dist: python-dotenv; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs; extra == 'docs'
Requires-Dist: mkdocs-material; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Description-Content-Type: text/markdown

# pgdumplib

Python 3 library for reading and writing pg_dump files using the custom format.

[![Version](https://img.shields.io/pypi/v/pgdumplib.svg)](https://pypi.python.org/pypi/pgdumplib)
[![Status](https://github.com/gmr/pgdumplib/workflows/Testing/badge.svg)](https://github.com/gmr/pgdumplib/actions)
[![Coverage](https://codecov.io/gh/gmr/pgdumplib/branch/master/graph/badge.svg)](https://codecov.io/github/gmr/pgdumplib?branch=master)
[![License](https://img.shields.io/pypi/l/pgdumplib.svg)](https://github.com/gmr/pgdumplib/blob/master/LICENSE)
[![Docs](https://img.shields.io/badge/docs-github%20pages-blue)](https://gmr.github.io/pgdumplib/)

## Installation

```bash
pip install pgdumplib
```

## Example Usage

The following example shows how to create a dump and then read it in, and
iterate through the data of one of the tables.

```bash
pg_dump -d pgbench -Fc -f pgbench.dump
```

```python
import pgdumplib

dump = pgdumplib.load('pgbench.dump')

print('Database: {}'.format(dump.toc.dbname))
print('Archive Timestamp: {}'.format(dump.toc.timestamp))
print('Server Version: {}'.format(dump.toc.server_version))
print('Dump Version: {}'.format(dump.toc.dump_version))

for line in dump.table_data('public', 'pgbench_accounts'):
    print(line)
```
