All Projects → omniti-labs → Pg_extractor

omniti-labs / Pg_extractor

PG Extractor - Advanced PostgreSQL Dump Filter

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pg extractor

Gobackup
🗄 Simple tool for backup your databases, files to FTP / SCP / S3 storages.
Stars: ✭ 472 (+239.57%)
Mutual labels:  postgresql, backup
Wal G
Archival and Restoration for Postgres
Stars: ✭ 1,974 (+1320.14%)
Mutual labels:  postgresql, backup
Django Dbbackup
Management commands to help backup and restore your project database and media files
Stars: ✭ 471 (+238.85%)
Mutual labels:  postgresql, backup
Pg rman
Backup and restore management tool for PostgreSQL
Stars: ✭ 197 (+41.73%)
Mutual labels:  postgresql, backup
Agent
The best way to backup and restore your database
Stars: ✭ 80 (-42.45%)
Mutual labels:  postgresql, backup
Pg probackup
Backup and recovery manager for PostgreSQL
Stars: ✭ 383 (+175.54%)
Mutual labels:  postgresql, backup
Bareos
Main repository with the code for the libraries and daemons
Stars: ✭ 651 (+368.35%)
Mutual labels:  postgresql, backup
Wal E
Continuous Archiving for Postgres
Stars: ✭ 3,313 (+2283.45%)
Mutual labels:  postgresql, backup
Barman
Barman - Backup and Recovery Manager for PostgreSQL
Stars: ✭ 1,044 (+651.08%)
Mutual labels:  postgresql, backup
Pghoard
PostgreSQL backup and restore service
Stars: ✭ 1,027 (+638.85%)
Mutual labels:  postgresql, backup
Elephant Shed
PostgreSQL Management Appliance
Stars: ✭ 146 (+5.04%)
Mutual labels:  postgresql, backup
Backup Manager
Database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, SFTP, and Rackspace Cloud
Stars: ✭ 1,589 (+1043.17%)
Mutual labels:  postgresql, backup
Backup
Easy full stack backup operations on UNIX-like systems.
Stars: ✭ 4,682 (+3268.35%)
Mutual labels:  postgresql, backup
Pgbackrest
Reliable PostgreSQL Backup & Restore
Stars: ✭ 766 (+451.08%)
Mutual labels:  postgresql, backup
Pitrery
PostgreSQL Point In Time Recovery made easy
Stars: ✭ 99 (-28.78%)
Mutual labels:  postgresql, backup
Backy2
backy2: Deduplicating block based backup software for ceph/rbd, image files and devices
Stars: ✭ 126 (-9.35%)
Mutual labels:  postgresql, backup
Mybatis Plus
An powerful enhanced toolkit of MyBatis for simplify development
Stars: ✭ 12,132 (+8628.06%)
Mutual labels:  postgresql
Mysqldump
Node Module to Create a Backup from MySQL
Stars: ✭ 136 (-2.16%)
Mutual labels:  backup
Checkpoint
Fast and simple homebrew save manager for 3DS and Switch.
Stars: ✭ 1,886 (+1256.83%)
Mutual labels:  backup
Masquerade
A Postgres Proxy to Mask Data in Realtime
Stars: ✭ 134 (-3.6%)
Mutual labels:  postgresql

PGExtractor is both a command line script and python class that can be used to provide more finely detailed filtering options for PostgreSQL's pg_dump program. Each database object is extracted into its own file organized into folders by type. This makes having the database schema as a reference easier and allows for better checking into version control. By default data is not dumped, but is easily done with a single option and can be done as plaintext or pg_dump's custom format. Object filtering can be done directly via command line options or fed in with external text files. Regex pattern matching is also possible.

See --help & --examples for a full list of available options and how to use the script.

The script only uses pg_dump/all to touch the database. pg_restore is only used for generating ddl and does not ever touch the database.

This script natively requires Python 3. The 3to2 script can be used to allow it work work with Python 2.7, but it will not always be guarenteed to work. https://pypi.python.org/pypi/3to2

$ 3to2 -w pg_extractor.py

Python 3 was chosen for its more consistent treatment of plaintext and binary file formats. Since this is a text processing script, that consistency makes development easier and more predictable. Also, Python 3 has been out since 2008 and all major OS distributions have packages available, so I'm doing my small part to help drive adoption to the new major version.

Several of the class methods are public and can be used to inspect a custom format binary dump file or apply some of the editing options.

Python 3.3.1 (default, Sep 25 2013, 19:29:01) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pg_extractor import PGExtractor
>>> p = PGExtractor()
>>> object_list = p.build_main_object_list("dumpfile.pgr")
>>> table_object_list = p.build_type_object_list(object_list, ['TABLE'])
>>> for t in table_object_list:
...     print(t)
... 
{'objname': 'job_detail_p0', 'objid': '238; 1259 596233', 'objowner': 'keith', 'objtype': 'TABLE', 'objschema': 'jobmon'}
{'objname': 'job_detail_p10', 'objid': '239; 1259 596244', 'objowner': 'keith', 'objtype': 'TABLE', 'objschema': 'jobmon'}
...

Remove the password hashes from an existing "pg_dumpall -r" roles file:

>>> p.remove_passwords("pg_dumpall_roles.sql")

New Version 2.x

Version 2.x is a complete rewrite of PG Extractor in python. Most of the configuration options are the same, but many have been changed for clarity, so please check the --help.

Non-compatibilities with 1.x to be aware of when dropping in 2.x to replace it

  • Requires Python 3
  • The "hostname" is no longer a default part of the directory structure created. If this is still desired, set the --hostnamedir option with whatever the existing directory is.
  • Built in version control options are gone. They were rather fragile options and could easily lead to a whole lot of things getting checked into version control that should not have been. I've found it's easier (and safer) to manage version control check-ins separately. If these are really wanted please create an Issue on github and I'll consider it if there's enough interest.
  • Removed --rolesdir option

New features:

  • Full Python 3 class object with public methods that may possibly be useful on existing dump files
  • --jobs option to allow parallel object extraction
  • --remove_passwords option can remove the password hashes from an extracted roles file
  • --getdefaultprivs extracts the default privileges set for any roles that used ALTER DEFAULT PRIVILEGES
  • --delete cleans up empty folders properly
  • --wait option to allow a pause in object extraction. Helps reduce load when data is included in extraction.
  • --temp option to allow setting custom temporary working space
  • Sequences files can now include the statement to set the current value if data is output
  • Better support for when objects have mixed case names or special characters. Special characters in an object name turn into ,hexcode, to allow a valid system filename.
  • Rules & Triggers on views are now always included in the view file itself properly.

The version 1.x series written in perl will no longer be developed. Only bug fixes to the existing code will be accepted.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].