Code Monkey home page Code Monkey logo

migration-blobs's Introduction

Migration Blobs

A simple tool for migration of large objects from old PostgreSQL.

Usage

$ git clone [email protected]:LevZaplatin/migration-blobs.git
$ cd migration-blobs/
$ virtualenv .venv
$ source .venv/bin/activate
(.venv) $ pip install -r requirements.txt
(.venv) $ python3 migration-blobs.py backup -H 127.0.0.1 -w -U pgsql -p 5432 -d app -o ./blobs/ -c 5000
(.venv) $ python3 migration-blobs.py restore -H 127.0.0.1 -w -U pgsql -p 5432 -d app -o ./blobs/

Output file

SELECT pg_catalog.lo_create('1201210');
SELECT pg_catalog.lo_open('1201210', 131072);
SELECT pg_catalog.lowrite(0, '\x<hex content>');
SELECT pg_catalog.lowrite(0, '\x<hex content>');
SELECT pg_catalog.lowrite(0, '\x<hex content>');
SELECT pg_catalog.lowrite(0, '\x<hex content>');
SELECT pg_catalog.lowrite(0, '\x<hex content>');
SELECT pg_catalog.lo_close(0);

Help

usage: migration-blobs.py [-h] [-W PASSWORD] [-w] [-p PORT] [-v] -H HOST -d
                          DATABASE -U USER -o PATH
                          action

Migration tool for generating SQL dump and restoring it

positional arguments:
  action                backup or restore

optional arguments:
  -h, --help            show this help message and exit
  -W PASSWORD, --password PASSWORD
                        PG password
  -w, --no-password     Empty password
  -p PORT, --port PORT  PG port (default: 5432)
  -v, --verbose         Verbose mode

required arguments:
  -H HOST, --host HOST  PG hostname
  -d DATABASE, --database DATABASE
                        PG database
  -U USER, --user USER  PG user
  -o PATH, --path PATH  Storage folder

migration-blobs's People

Contributors

levzaplatin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.