Skip to main content

Python3 library for working with pg_dump files

Project description

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

Package Version Build Status Code Coverage BSD Documentation Status

Installation

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.

pg_dump -d pgbench -Fc -f pgbench.dump
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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pgdumplib, version 3.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pgdumplib-3.1.0.tar.gz (16.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page