• Stars
    star
    5,092
  • Rank 7,814 (Top 0.2 %)
  • Language
    Common Lisp
  • License
    Other
  • Created about 14 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Migrate to PostgreSQL in a single command!

PGLoader

Build Status Join the chat at https://gitter.im/dimitri/pgloader Read The Docs Status

pgloader is a data loading tool for PostgreSQL, using the COPY command.

Its main advantage over just using COPY or \copy, and over using a Foreign Data Wrapper, is its transaction behaviour, where pgloader will keep a separate file of rejected data, but continue trying to copy good data in your database.

The default PostgreSQL behaviour is transactional, which means that any erroneous line in the input data (file or remote database) will stop the entire bulk load for the table.

pgloader also implements data reformatting, a typical example of that being the transformation of MySQL datestamps 0000-00-00 and 0000-00-00 00:00:00 to PostgreSQL NULL value (because our calendar never had a year zero).

Documentation

Full documentation is available online, including manual pages of all the pgloader sub-commands. Check out https://pgloader.readthedocs.io/.

$ pgloader --help
pgloader [ option ... ] SOURCE TARGET
  --help -h                       boolean  Show usage and exit.
  --version -V                    boolean  Displays pgloader version and exit.
  --quiet -q                      boolean  Be quiet
  --verbose -v                    boolean  Be verbose
  --debug -d                      boolean  Display debug level information.
  --client-min-messages           string   Filter logs seen at the console (default: "warning")
  --log-min-messages              string   Filter logs seen in the logfile (default: "notice")
  --summary -S                    string   Filename where to copy the summary
  --root-dir -D                   string   Output root directory. (default: #P"/tmp/pgloader/")
  --upgrade-config -U             boolean  Output the command(s) corresponding to .conf file for v2.x
  --list-encodings -E             boolean  List pgloader known encodings and exit.
  --logfile -L                    string   Filename where to send the logs.
  --load-lisp-file -l             string   Read user code from files
  --dry-run                       boolean  Only check database connections, don't load anything.
  --on-error-stop                 boolean  Refrain from handling errors properly.
  --no-ssl-cert-verification      boolean  Instruct OpenSSL to bypass verifying certificates.
  --context -C                    string   Command Context Variables
  --with                          string   Load options
  --set                           string   PostgreSQL options
  --field                         string   Source file fields specification
  --cast                          string   Specific cast rules
  --type                          string   Force input source type
  --encoding                      string   Source expected encoding
  --before                        string   SQL script to run before loading the data
  --after                         string   SQL script to run after loading the data
  --self-upgrade                  string   Path to pgloader newer sources
  --regress                       boolean  Drive regression testing

Usage

You can either give a command file to pgloader or run it all from the command line, see the pgloader quick start on https://pgloader.readthedocs.io for more details.

$ ./build/bin/pgloader --help
$ ./build/bin/pgloader <file.load>

For example, for a full migration from SQLite:

$ createdb newdb
$ pgloader ./test/sqlite/sqlite.db postgresql:///newdb

Or for a full migration from MySQL, including schema definition (tables, indexes, foreign keys, comments) and parallel loading of the corrected data:

$ createdb pagila
$ pgloader mysql://user@localhost/sakila postgresql:///pagila

LICENCE

pgloader is available under The PostgreSQL Licence.

INSTALL

Please see full documentation at https://pgloader.readthedocs.io/.

If you're using debian, it's already available:

$ apt-get install pgloader

If you're using docker, you can use the latest version built by the CI at each commit to the master branch:

$ docker pull ghcr.io/dimitri/pgloader:latest
$ docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader --version

More Repositories

1

el-get

Manage the external elisp bits and pieces upon which you depend!
Emacs Lisp
1,641
star
2

pgcopydb

Copy a Postgres database to a target Postgres server (pg_dump | pg_restore on steroids)
C
974
star
3

pgcharts

Turn your PostgreSQL queries into Charts
Common Lisp
387
star
4

switch-window

Offer a *visual* way to choose a window to switch to
Emacs Lisp
288
star
5

regresql

Regression Testing your SQL queries
Go
254
star
6

emacs-kicker

A minimal kick start init file for emacs
Emacs Lisp
145
star
7

prefix

Prefix Range module for PostgreSQL
C
96
star
8

pgextwlist

PostgreSQL Extension Whitelisting
C
92
star
9

sudoku

Solving Every Sudoku Puzzle
Python
58
star
10

preprepare

PostgreSQL prepare statements made pooling friendly
C
45
star
11

tpch-citus

Drivers to run TPC-H with Citus and PostgreSQL
C
31
star
12

nba

Aggregating NBA data
Common Lisp
30
star
13

pg_staging

Setup and maintain your staging environments from your production backups!
Python
28
star
14

cssh

ClusterSSH meets Emacs
Emacs Lisp
27
star
15

cl-abnf

ABNF Parser Generator, per RFC2234
Common Lisp
27
star
16

pgdevenv-el

PostgreSQL Development Tool for Emacs
Emacs Lisp
23
star
17

ql-to-deb

Update cl-* debian packages from Quicklisp releases.
Common Lisp
23
star
18

mbsync-el

Wrap calling mbsync in Emacs Lisp, with a gnus hook
Emacs Lisp
23
star
19

libphp-pgq

PHP level API for PGQ PostgreSQL Queing solution
PHP
17
star
20

pg_basebackup

Make your PostgreSQL base backup from a plain connection to the server (as superuser)
Python
17
star
21

kids

Helping kids discover computing
Common Lisp
16
star
22

base36

PostgreSQL base36 data type input/output support, internally a bigint.
C
14
star
23

getddl

Get the DDL from a live database and split them in files and directories
Python
14
star
24

tapoueh.org

Sources of the tapoueh.org web site, using Hugo
HTML
13
star
25

taop.xyz

The Art of PostgreSQL
HTML
13
star
26

apt.postgresql.org

debian packaging scripts for PostgreSQL.org
Shell
12
star
27

pginstall

The PostgreSQL Extension Installer
Common Lisp
11
star
28

emacs.d

My Emacs Setup
Emacs Lisp
9
star
29

pgsql-linum-format

a linum-mode hook to display PostgreSQL functions line numbers
Emacs Lisp
8
star
30

pgconfs

dim's PostgreSQL Conferences Slides, the sources.
PostScript
8
star
31

cl-db3

A Common Lisp lib to read dbf files version 3.
Common Lisp
7
star
32

pubnames

The Most Popular Pub Names
Common Lisp
7
star
33

subcommands.c

Another single-file header C lib: command line, file paths manipulation API, run subprograms.
C
7
star
34

AdventOfCode

Implementation of Advent Of Code puzzles in Common Lisp, just for fun.
Common Lisp
7
star
35

masteringpostgresql.com

My new book, still in the making.
CSS
7
star
36

plconvert

Convert code in between non standard database Procedural Languages.
Common Lisp
6
star
37

mailq-el

Emacs major mode for `mailq' interaction
Emacs Lisp
5
star
38

toy-parser

How to build a parser and have a compiler for free, in Common Lisp.
Common Lisp
5
star
39

mysqltopgsql.com

How to migrate from MySQL to PostgreSQL
HTML
5
star
40

pgsrc-el

PostgreSQL source editing facilities for Emacs
Emacs Lisp
3
star
41

rcirc-groups

an emacs buffer in rcirc-groups major mode
Emacs Lisp
3
star
42

cl-ixf

Parse IBM IXF file format.
Common Lisp
2
star
43

go-hello-world

Concurrent Hello World, in Common Lisp
Common Lisp
2
star
44

artisan-mysql

Common Lisp Native Driver for MySQL
Common Lisp
2
star
45

preventddl

set preventddl.enable to true;
PLpgSQL
1
star
46

pgaf_debian

debian packaging for apt.pg.o for pg_auto_failover
1
star
47

cl-pgdumpfile

Common Lisp library that knows how to read a PostgreSQL dump file in custom format.
Common Lisp
1
star
48

Citus-tutorial

Automate the Citus tutorial steps into a single command.
Makefile
1
star
49

pgloader.io

Public Website for the pgloader project.
SCSS
1
star