Compare commits

...

559 Commits

Author SHA1 Message Date
Svante von Erichsen
d9ca38eacf
Merge pull request #1674 from fossum/feature/fix-dockerfile-casing
Eliminate docker build casing warning
2025-06-04 09:52:57 +02:00
Eric Fossum
b76be4450c Eliminate docker build casing warning 2025-06-03 08:41:13 -07:00
Svante von Erichsen
096992acbc fix IPv6 hostname parsing (#1004) 2025-05-25 01:26:22 +02:00
Arunprasad Rajkumar
70f3557670
Use latest cosign action to fix signing issue on docker publish (#1613)
Signed-off-by: Arunprasad Rajkumar <ar.arunprasad@gmail.com>
2024-09-18 14:26:47 +02:00
Arunprasad Rajkumar
edc1a4fde9
Install CA certificates on docker image (#1612)
Currently, we install ca-certificates package only on the builder, not
on the docker image which is distributed to the user. Without CA
certificates, we see errors like below,
```
2024-09-18T05:30:46.112001Z ERROR Connecting to PostgreSQL <host name>: SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
DB-CONNECTION-ERROR: Failed to connect to pgsql at "<host name>" (port 30025) as user "tsdbadmin": SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
An unhandled error condition has been signalled:
   Failed to connect to pgsql at "<host name>" (port 30025) as user "tsdbadmin": SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
```

Signed-off-by: Arunprasad Rajkumar <ar.arunprasad@gmail.com>
2024-09-18 11:37:57 +02:00
Christoph Berg
29afa9de05 Merge branch 'debian' 2024-06-11 17:01:37 +00:00
Christoph Berg
44f04aff78 Bump pgloader minor version and add checks
The version number in `pgloader --version` was missed in the last few
releases.
2024-06-11 16:59:21 +00:00
Christoph Berg
f0409e549d Limit architectures to those that have sbcl available and working thread support (notably, this excludes armel and armhf). 2024-03-22 15:01:36 +01:00
Svante von Erichsen
2079646c81
Merge pull request #1500 from jarinom/fix-dockerfile-debian-bookworm
Fix Dockerfile build after new Debian release
2023-11-08 16:35:32 +01:00
Christoph Berg
af8c3c1472 pgloader 3.6.10 2023-11-02 16:49:50 +00:00
Christoph Berg
c722964096 Debian: Bump ip4r dependencies to 16.
(Closes: #1052837)
2023-11-02 17:44:59 +01:00
Jari Ylimäinen
e58809aff3 Pin Debian version to Bookworm and fix dependencies 2023-06-13 15:50:56 +03:00
kobaaa
999791d013
allow db names with dot (#1059) 2022-11-03 14:42:35 +01:00
Christoph Berg
b0f0f8313b Debian: Check if build really built pgloader
Cannot save core with multiple threads running.
2022-10-24 13:52:05 +02:00
Christoph Berg
3e06d1b9e1 New version 3.6.9 2022-10-24 13:12:05 +02:00
Christoph Berg
99090836a2 Use pgapt repository for testing
Required to make postgresql-15-ip4r available.
2022-10-24 13:07:18 +02:00
Christoph Berg
84ed9c6c48 Bump ip4r dependencies to 15
Closes: #1022296
2022-10-24 12:59:19 +02:00
Dimitri Fontaine
6d61c8c770
Add a setup for readthedocs. 2022-10-18 19:51:15 +02:00
Dimitri Fontaine
9011fcde13
Clean-up docs/conf.py (remove old cruft). 2022-10-18 19:41:57 +02:00
Dimitri Fontaine
626f437963
Improve docs formatting of command line options. 2022-10-18 19:20:52 +02:00
Dimitri Fontaine
925996000b
Improve pgloader docs (Table of Contents, titles, organisation). (#1440)
Make it easier to nagivate our docs, which are dense enough to warrant
proper organisation and guided Table of Contents.
2022-10-18 17:28:34 +02:00
Justin Falk
6d73667685
Add default support for MSSQL auto-incrementing bigint and smallint (#1435)
* Add default support for MSSQL auto-incrementing bigint and smallint

* Update list-all-columns.sql

Add support for sysdatetimeoffset defaults

* Update mssql-cast-rules.lisp

Correct bigint cast
2022-10-18 16:54:08 +02:00
Christoph Berg
759777ae08 New upstream version. 2022-09-26 14:25:44 +02:00
Christoph Berg
59d2c5c7fd Depend on libsqlite3-0.
pgloader  --regress allcols.load

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {10070C8003}>:
  Error opening shared object "libsqlite3.so.0":
  libsqlite3.so.0: cannot open shared object file: No such file or directory.
2022-09-26 11:41:33 +02:00
Christoph Berg
350bcc09d1 Debian: run wrap-and-sort -ast 2022-09-26 11:08:11 +02:00
padinko
90dea2ad4e
Fix mapping mysql signed int with auto_incement to postgresql serial (#1248) (#1437) 2022-09-22 13:11:34 +02:00
willyrk1
f25f1b659c
(Re-)Fix documentation link (#1434) 2022-09-21 00:40:51 +02:00
noctarius aka Christoph Engelbert
644f2617e7
Added support for sequences with minvalue defined (#1429)
When a sequence is defined with a minimum value, and the sequence to migrate is empty, the setval fails due to 1 being the default (which may be lower than the defined minimum value)

Signed-off-by: Christoph Engelbert (noctarius) <me@noctarius.com>
2022-09-12 16:17:49 +02:00
Eugen Mayer
8ff0c574b3
Fix documentation link (#1426) 2022-08-29 15:53:50 +02:00
Dimitri Fontaine
75c00b5ff4
Use the unix-namestring as the hash key for SQL queries. (#1420)
The way we manage and then fetch the SQL queries embedded in the pgloader
binary we should really take the unix-namestring rather than the
native-namestring. Of course, this only matters when the host OS is NOT
unix, which is why this bug existed for so long.
2022-08-18 14:16:58 +02:00
Dimitri Fontaine
696617d930
Upgrade Clozure-CL in the Dockerfile.ccl. 2022-08-18 14:01:03 +02:00
Christoph Berg
755b55d2b3 New upstream version 2022-08-13 10:35:39 +02:00
Christoph Berg
b24eba972d Set SBCL dynamic space size to 16 GB on 64 bit architectures. 2022-08-12 22:57:51 +02:00
Dimitri Fontaine
28ef36a6dc
README and install docs improvements. 2022-08-12 17:32:55 +02:00
Dimitri Fontaine
5f5734cf01
Update current version number, latest release being 3.6.6. 2022-08-12 17:23:14 +02:00
Dimitri Fontaine
ff33ec5e2e
Improve README and add proper INSTALL docs. (#1417) 2022-08-12 17:10:34 +02:00
Dimitri Fontaine
fac03a68d4
Install a github action to publish docker images. (#1416)
* Install a github action to publish docker images.

* Our main branch name is still "master".
2022-08-12 16:39:05 +02:00
Dimitri Fontaine
8d97a313fa
Improve documentation with command lines and defaults. (#1415)
* Improve documentation with command lines and defaults.

The advanced documentation coverage skipped the simple approach and didn't
explain fully what to do with the sample commands.

Fixes #1413.

* Fix docs indentation in the MySQL connection string options.

* Desultory docs and docs config fixes.
2022-08-12 15:27:40 +02:00
Dimitri Fontaine
eeefcaa98e
SBCL compiler notes should not be fatal to pgloader. (#1411)
* SBCL compiler notes should not be fatal to pgloader.

The compile function returns warnings-p and failure-p values, use that to
decide if the code could be compiled, and only signal a condition when it
has been fatal to compiling the code at run-time.

The SBCL compiler is getting smarter at removing unreachable code, and it
looks like pgloader is producing some unreachable code from parsing the user
provided commands.

* Let's make the code look like actual lisp code now.

* Another fix.

* Improve condition handling and simplify processing of compile values.

We don't need to react to any condition signaled from inside pgloader, only
to errors and serious-conditions (an error is a serious-condition). With
that, we can just ignore the compiler warnings and style notes.

* Fix the handler-bind to only consider serious-conditions too.

* Capture compiler output as log it as a debug level message.

* Fix previous attempt.

* Improve capturing of the compiler output (include summary).

* Actually call the new compile function in all places.

Co-authored-by: Dimitri Fontaine <dimitri@citusdata.com>
2022-08-11 17:06:27 +02:00
Christoph Berg
2c52da12cb Sync version numbers 2022-06-27 11:03:22 +02:00
Christoph Berg
b890b32cc1 releasing package pgloader version 3.6.5-1 2022-06-27 10:25:28 +02:00
Christoph Berg
10ee9d931a Remove regression output on clean 2022-06-26 23:32:55 +02:00
Christoph Berg
7c0d478064 Debian: Run tests at build-time as well. 2022-06-26 23:31:54 +02:00
Christoph Berg
05282173d4 bootstrap-centos.sh: Bump sbcl version to 2.2.5
Close #956
2022-06-24 16:28:51 +02:00
Christoph Berg
12d4885f3d Remove bundle files on clean 2022-06-24 16:22:00 +02:00
Christoph Berg
a56f5a4b25 Build bundle file
Close #1347
2022-06-24 16:17:29 +02:00
Christoph Berg
f667fcc666 debian/watch: Look at tags instead of releases 2022-06-24 15:12:05 +02:00
Christoph Berg
3f1ca18229 New upstream version 3.6.4 2022-06-24 14:39:50 +02:00
Vincent GRAILLOT
55d76af6c9 Fix documentation typo
CSV Source Specification: From
One of special values are `FILENAME MATCHING` and not `FILENAMES MATCHING`
2022-06-24 14:13:20 +02:00
Christoph Berg
ebad5e2e57 debian/tests/testsuite: Use trust authentication 2022-06-24 13:21:29 +02:00
Christoph Berg
e19329be99 debian/tests/testsuite: Use installed pgloader binary 2022-06-24 10:47:29 +02:00
Christoph Berg
4eb618d45f .github/workflows/debian-ci.yml: We are not on focal, drop special rule 2022-06-24 10:45:49 +02:00
Christoph Berg
9c904b67d1 debian/tests/testsuite: Run "regress" instead of "all" 2022-06-24 10:41:14 +02:00
Christoph Berg
e234ff188e test: Create csv schema in partial.load 2022-06-24 10:39:15 +02:00
Dimitri Fontaine
e2418891a4
Fix looping over sbcl *external-formats*.
The internal represtation of the SBCL *external-formats* has changed to a
new structure which is not an hash-table anymore.
2022-06-23 17:15:47 +02:00
Christoph Berg
3853c8996f test: Depend on postgresql-14-ip4r 2022-06-23 16:25:55 +02:00
Christoph Berg
087ddce749 Run testsuite 2022-06-23 16:20:14 +02:00
Christoph Berg
b54ed07175 Ignore some Debian build artifacts 2022-06-23 16:08:36 +02:00
Christoph Berg
8451ca5158 test: Don't run sakila test by default; set variables for tests
Sakila needs a MySQL database running. Set DBPATH and SOURCEFILE for the
sqlite-env.load and csv-districts-env.out tests.
2022-06-23 15:59:11 +02:00
Brendan Ball
4114daf190 parameterize DYNSIZE in dockerfiles 2022-06-23 14:20:38 +02:00
Christoph Berg
85f2d3e55b Add Debian autopkgtest 2022-06-23 14:11:37 +02:00
Christoph Berg
71c922f0dd Remove docker-ci workflow
It was never properly hooked up.
2022-06-23 13:51:04 +02:00
Darryl T. Agostinelli
c9616e2675 specify v8 of freetds to deal with #1068 'MSSQL to Postgres: is not of type VECTOR' 2022-06-23 13:48:34 +02:00
Scott Thomas
7e1f7c51c8 Allow underscores in cast type names
Underscores might exist in cast type names, for example if the type being cast is an enum (which can have arbitrary names).

Fixes #1378
2022-06-23 13:43:21 +02:00
Joakim Soderlund
6de6457d65 Fix minor casing issue in intro docs 2022-06-23 13:33:51 +02:00
Athos Ribeiro
248c2f709a Force libcrypto reload in src/hooks.lisp
cl+ssl::libcrypto is also read at startup. If not properly closed in the
hooks, together with libssl, libcrypto will be loaded at startup and if
the first cl+ssl file alternative fails, the debugger is invoked.

* Fixes #1370
2022-06-23 13:28:35 +02:00
Christoph Berg
a94a0a3327 debian/tests/ssl: Force md5 auth if cl-postmodern is too old. 2021-12-22 18:08:21 +01:00
Christoph Berg
0925960989 pgloader 3.6.3 2021-12-22 17:27:14 +01:00
Christoph Berg
3b6fa226b8 Debian: Revert temporarily ignored file 2021-12-22 17:25:47 +01:00
Christoph Berg
4f1650f084 Debian: Remove obsolete lintian overrides 2021-12-22 17:24:50 +01:00
Christoph Berg
11dc31d05c docs/ref/pgsql-redshift.rst: Fix too short title underline 2021-12-22 17:07:31 +01:00
Christoph Berg
a8c50e37f8 Fix places2k.zip location
Close #375
2021-12-21 10:36:14 +01:00
ChristophKaser
40f6ba1ff4 Fixes typo in MS SQL Migration Options docs 2021-12-21 10:20:39 +01:00
Dmitry Shvetsov
2e728f5754 Fix typo in the log message 2021-12-21 10:10:38 +01:00
Christoph Berg
92dfb3f706 Debian: Remove cl-pgloader, deprecated upstream. 2021-12-21 10:10:23 +01:00
Phil Ingram
f49252d6b4 Add openssl-devel dependency to pgloader.spec 2021-12-09 16:56:09 +01:00
Scott Markwell
4bd4c0ef08 Spelling correction 2021-12-09 16:54:12 +01:00
marcel-tomes
a8512e60fa Fix typo 2021-12-09 16:53:25 +01:00
Nitish
3047c9afe1
Typo fix in MS SQL documentation (#1242) 2020-12-14 01:04:47 +01:00
Rodolphe Quiédeville
63e4eea5f0
Add postgres version 13 tto Travis (#1235)
Update the travis-ci configuration to run test on latest stable version ie 13
2020-11-21 20:13:08 +01:00
Jeffrey van den Hondel
45a4b6f353
chore: create workflow docker-ci (#1217)
* chore: create workflow docker-ci

* fix: missing closing fi

Co-authored-by: Jeffrey van den Hondel <jeffrey.vandenhondel@autoflex.nl>
2020-10-19 17:44:48 +02:00
kocio-pl
b60c5feedd
Update index.rst (#1213)
Fix the header "On error stop / On error resume next"
2020-10-19 17:26:15 +02:00
lukesilvia
48d8ed0613
fix: ranged load does not load last record. (#1203) 2020-08-31 20:12:32 +02:00
Aleksi Kinnunen
9788cc64ee
Add MySQL unsigned int casting rules (#1200)
Fixes dimitri/pgloader#1186
2020-08-28 11:24:36 +02:00
Dimitri Fontaine
e388909f0c Implement a retry loop when SQLite database is "BUSY".
It turns our that you can't do some operations on SQLite from several
concurrent connections, such as a "pgrama encoding" query.

Fixes #1193.
2020-07-27 21:12:55 +02:00
Christoph Berg
49e5877853 Merge branch 'debian' 2020-07-14 17:35:53 +02:00
Christoph Berg
11e6627ea8 releasing package pgloader version 3.6.2-1 2020-07-14 17:02:51 +02:00
Christoph Berg
455800139f debian: Note that we need cl-plus-ssl 20190204 or later. 2020-07-14 16:52:17 +02:00
Christoph Berg
c1d58b6dd9 debian: Note that we need cl-csv 20180712 or later. 2020-07-14 16:15:45 +02:00
Christoph Berg
9c2d8d2baa debian: Note that we need cl-plus-ssl 20180328 or later. 2020-07-14 15:33:31 +02:00
Christoph Berg
63274dbec4 debian/rules: Skip dh_dwz like dh_strip as it fails on buster. 2020-07-14 15:08:41 +02:00
Christoph Berg
c8ceb1cf8f debian: Add patch to remove sphinx theme options on bionic 2020-07-13 17:17:09 +02:00
Christoph Berg
2100690402 debian: Clean buildapp log 2020-07-13 16:48:05 +02:00
Christoph Berg
5bfa5430cf debian/rules: Print actual compiler log. 2020-07-13 16:30:12 +02:00
Dimitri Fontaine
f5139cbf29 Add support for DATETIME() function call as a SQLite default values.
Fixes #1177.
2020-07-03 18:39:37 +02:00
Christoph Berg
164726eab9 DH 13. 2020-06-10 15:28:27 +02:00
Christoph Berg
d024552f56 Bump required cl-db3 version to 20200212. 2020-06-10 15:27:50 +02:00
Christoph Berg
a06900e898 New upstream version. 2020-06-10 14:32:40 +02:00
Christoph Berg
f8ef9c2dc3 Merge tag 'v3.6.2' into debian 2020-06-10 14:26:33 +02:00
Dimitri Fontaine
689dd4a806 Simplify Postgres version string parsing further. 2020-06-06 17:07:06 +02:00
Dimitri Fontaine
cc8975bb88 Improve Postgres version string parsing.
Turns out we have way more variety in the field than what I anticipated...

Should fix #992.
2020-06-05 18:47:32 +02:00
Dimitri Fontaine
2189acfb63 Attempt at fixing #1060. 2020-06-05 18:22:47 +02:00
Drew Repasky
a76f7e1e8c
typo (#1152) 2020-05-26 21:06:17 +02:00
Dimitri Fontaine
1bdc0ee5f4 Allow SQLite type names such as "double precision".
The parsing of the type names from the SQLite catalogs needs to allow for
names with spaces in them, because SQLite allows that too.

Fixes #921.
2020-05-09 23:55:59 +02:00
Semen Miroshnichenko
11d926126e
Keep name casing for foreign keys on mssql (#1145) 2020-05-09 17:49:04 +02:00
Dimitri Fontaine
38a62a7143 Attempt to add Github sponsors to the pgloader home page. 2020-05-05 18:51:18 +02:00
Dimitri Fontaine
d5314a6640 Add support for type "signed long" in SQLite.
Fixes #1126.
2020-04-11 18:33:21 +02:00
Ian L
cb989e1155
Fix MySQL query to compute number of rows per table (#1128)
The CAST should target `unsigned` rather than `integer`, so that we are compatible with MySQL 5.7. Also empty tables might have NULL entries, which we transform to zero entries here, as expected by the Lisp code.

Fixes #1127.
2020-04-11 18:22:02 +02:00
Dimitri Fontaine
86b6a5cb80 We COPY the MS SQL data in the MS SQL column ordering.
Fix #1124.
2020-04-05 15:12:46 +02:00
Dimitri Fontaine
11970bbca8
Implement tables row count ordering for MySQL. (#1120)
This should help optimise the duration of migrating databases with very big
tables and lots of smaller ones. It might be a little too naive as far as
the optimisation goes, while still being an improvement on the default
alphabetical one.

Fixes #1099.
2020-04-04 16:40:53 +02:00
Dimitri Fontaine
14fb15bfbd Force the summary file to be opened in UTF-8.
After all the default summary output contains the “✓” character and that
won't fit in the ascii external format.

Fixes #1103.
2020-04-03 23:49:20 +02:00
Dimitri Fontaine
49910027c5 Typo fix in the MySQL default casting rules documentation.
See #1123.
2020-04-03 23:34:53 +02:00
Michał "phoe" Herda
7b47c00ea7
Delete pgloader.lisp (#1119)
Fixes #1115
2020-03-28 16:53:19 +01:00
Michał "phoe" Herda
bd9cdcea82
Update pgloader.spec for 3.6.2 release (#1118)
Fixes #1116.
2020-03-28 16:53:04 +01:00
Michał "phoe" Herda
bab6aaf890
Simplify and fix errors/warnings/notes on Travis configuration (#1112)
Fixes #1111.

We remove unnecessary .travis.sh code for removing old Postgres versions.
2020-03-28 13:42:18 +01:00
Michał "phoe" Herda
5e7de5d68d
Change Travis build matrix (#1110)
We remove the Travis jobs without the PGLOADER environment variable set to fix #1109 and add Postgres versions 10, 11, and 12 to build and test pgloader against them.
2020-03-28 12:22:02 +01:00
Dimitri Fontaine
64643bff83 Fix MS SQL bigint casting to numeric.
Fixes #937.
2020-03-28 00:00:21 +01:00
Rudi Bruchez
c2b9f79413
handling mssql datetimeoffset (#1113) 2020-03-27 23:50:35 +01:00
Dimitri Fontaine
b3cd5f28d6 Set the MS SQL port in the environment.
As our API to connect to MS SQL does not provide a facility to set the
target port number, place it in the TDSPORT environment variable, which is
reported to have the expected impact.

Should fix #1094.
2020-03-27 23:24:16 +01:00
Svante von Erichsen
8c59f8c9f9
fix typo that chooses wrong option rule (#1107) 2020-03-27 23:14:58 +01:00
Michał "phoe" Herda
6b111ba483
Begin v3.6.3 development 2020-03-22 22:38:46 +01:00
Michał "phoe" Herda
484d3e1dd4
Release v3.6.2 2020-03-22 22:26:18 +01:00
Michał "phoe" Herda
e235c6049d
Update Quicklisp dist to 2020-02-18 (#1106)
#1092 requires us to switch to a new Quicklisp distribution in order to bump CFFI to version 0.21.0. This commit switches to the newest available QL dist (2020-02-18) to achieve this.
2020-03-22 16:59:19 +01:00
Jeff Fendley
be43a49646
Fix unfortunate typo in Redshift doc (#1075) 2020-03-22 16:42:48 +01:00
Dimitri Fontaine
c899d3b5c4 Fix zero-dates-to-null.
Fixes #1098.
2020-03-22 15:56:57 +01:00
Nicolas Delperdange
cc2dc8d671
fix(mysql): use new st_astext function (#1100) 2020-03-22 15:47:57 +01:00
Dimitri Fontaine
ebc72c454e Add a MySQL use case.
See #1102.
2020-03-22 15:20:19 +01:00
Dimitri Fontaine
0daace9d70 Allow source type names to be doube-quoted in CAST rules.
Fixes #1015.
2020-03-21 17:37:54 +01:00
Michał "phoe" Herda
94d0612c12
Do not reload pgloader in Makefile (#1091) 2020-03-21 12:36:31 +01:00
Dimitri Fontaine
30376b2cfe Add support for "datetime2" data type in MS SQL.
That's a blind fix, or almost blind: we're given some information but I'm
not in a position to test the fix myself. Hope it works.

Fixes #1036.
Fixes #1018.
2020-02-29 22:23:58 +01:00
Dimitri Fontaine
df94340396 Avoid parser look-ahead when not necessary.
Fixes #1082 where letters from the URI are doubled because of the
look-ahead in the previous parser's implementation.

Thanks @svantevonerichsen6906 for the fix!
2020-02-29 22:04:06 +01:00
Dimitri Fontaine
3b5c29b030 Attempt to fix foreign-key creation to tables that have been filtered out.
See #1016 where we try to build the DDL for a foreign key that references
tables that are not found in our catalogs. We should probably just ignore
those foreign keys, as we might have a partial load to implement.
2020-02-12 21:50:18 +01:00
Phil
2e8ce7a83c
Update rpm spec file (#1039)
* Update pgloader.spec
- Update from 3.3.2 to 3.6.1
- Use Requires and BuildRequires
- Variablise Source0
- Fix Prep and Files to match source tarball
- Update spec file Changelog

* link to install documentation for RedHat/CentOS. fix tab indentation of debian code block

* Update install instructions for RHEL/CentOS
2020-02-12 21:02:49 +01:00
Dimitri Fontaine
bbcce92418 Allow underscores in SQLite type names.
Fixes #1049.
2020-02-12 00:07:58 +01:00
Dimitri Fontaine
d4da90648e Implement proper hostname parsing, following labels specifications.
Bug report #1053 was the occasion to wander in the specification for DNS
hostnames and their label components, and the syntactic rules for those. It
turns out that my implementation was nothing like the specs:

  https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax

Fixes #1053.
2020-02-12 00:01:07 +01:00
Dimitri Fontaine
e551099463 Attempt at fixing a MS SQL bug.
That's another blind fix, but it looks like this should be doing it.
Hopefully. Chances to break pgloader even more are quite slim, so let's try
it in the master branch.

Fixes #1069.
2020-02-11 22:43:02 +01:00
Dimitri Fontaine
2fef253d28 Implement AFTER CREATE SCHEMA DO for more sources.
It was only implemented for Postgres sources even though the implementation
is generic enough to be shared. It's only a matter of instructing our parser
about the new facility, which this patch does.

Fixes #1062.
2020-02-11 22:20:08 +01:00
Dimitri Fontaine
8a13c02561 Review our Postgres catalog usage for default values.
The pg_catalog.pg_attribute column adsrc is populated only once, and then
not maintained by the server. The function pg_get_expr(adbin, adrelid) is
what to use and has been here since release 8.0, so that's what pgloader
should be using.

Fixed #1934.
2020-02-11 21:46:10 +01:00
Dimitri Fontaine
26cc9ca79f Implement support for DBF deleted records.
Skip over deleted records rather than blindly importing them. Requires an
update of the underlying DBF library.

Fixes #985.
2019-06-10 22:58:12 +02:00
Dimitri Fontaine
d8b0bd5145 Allow casting rules to guard on signed data types.
It used to be that our casting rules mechanism would allow for matching
unsigned data types only, and we sometimes have a need to do special
behavior on signed data types.

In particular, a signed bigint(20) in MySQL has the same values range as a
PostgreSQL bigint, so we don't need to target a numeric in that case. It's
only when the bigint is unsigned that we need to target a numeric.

In passing update some of the default casting rules documentation to match
the code.

Fix #982.
2019-06-04 15:22:25 +02:00
Dimitri Fontaine
b8da7dd2e9
Generic Function API for Materialized Views support. (#970)
Implement a generic-function API to discover the source database schema and
populate pgloader internal version of the catalogs. Cut down three copies of about
the same code-path down to a single shared one, thanks to applying some amount
of OOP to the code.
2019-05-20 19:28:38 +02:00
Elias Carter
ee75bc4765 Fix ccl docker images not having libssl (#968)
pgloader:ccl.latest throws an error: Shared library not open: "libssl.so.1.1". This commit adds libssl1.1 to the docker image which fixes the issue.
2019-05-17 09:47:18 +02:00
Dimitri Fontaine
12e788094b Improve sexp parser and standard symbols support.
Also add split-sequence to the list of special cases that we can use and is
not found in the pgloader.transforms package.

Fixes #965.
2019-05-14 15:49:24 +02:00
Dimitri Fontaine
501cbed745 Quote database name in ALTER DATABASE "..." SET search_path TO
Fixes #933.
2019-05-12 00:50:59 +02:00
Dimitri Fontaine
06216eea99 Refrain from using fancy schema names in the regression tests.
Then being compatible with PostgreSQL 9.6 is too much trouble.
2019-05-12 00:10:28 +02:00
Dimitri Fontaine
e5f78d978e Remove added DBF tests from the Travis target.
Clozure doesn't have the CP866 encoding that the DBF files are using, and
then PostgreSQL 9.6 doesn't have "create schema if not exists", which makes
the tests fail on Travis.
2019-05-11 23:52:47 +02:00
Dimitri Fontaine
98b465fbef Add the new DBF tests in the test suite.
All with expected results so that we can track regressions there.
2019-05-11 22:13:18 +02:00
Dimitri Fontaine
350cffffad Improve DBF support.
The cl-db3 lib just got improvements for new dbase file types and field
types, reflect those in pgloader.

Also, cl-db3 now can read the encoding of the file (language driver)
directly in the header, meaning we can rely on that metadata by default, and
only override it when the users tells us to.

See #961.
2019-05-11 20:50:52 +02:00
Dimitri Fontaine
a51819f874 Have db3-numeric-to-pgsql-integer accept integer values.
The cl-db3 driver is now parsing type I fields and emit them as native
integers. We need to deal with that.

See #929.
2019-05-10 22:09:52 +02:00
Dimitri Fontaine
954eca02d0 Optimize Travis-CI workload.
Before this patch Travis would build the pgloader image twice, one when
doing the `make clones save` command and another time when doing the main
command `make check`, that depends on Make targets that `make save` does not
build, such as buildapp.

Also, fix `make check-saved` to stop requiring that we save pgloader again.

Finally, use uiop:featurep to clean-up the code in the src/save.lisp file.
2019-05-09 10:52:09 +02:00
Dimitri Fontaine
351ce3faaf Rename pgloader's own DB3 field structure.
That's to avoid a name conflict with the cl-db3 package. In SBCL 1.5.2 in
Travis this conflict is an hard error and provoque failure to build the
pgloader binary.
2019-05-09 10:41:40 +02:00
Dimitri Fontaine
ca92cdbf20 Introduce core-compression discovery in make save to fix Travis builds. 2019-05-09 10:27:20 +02:00
Dimitri Fontaine
781e586816 Fix the SBCL 1.5.2 checksum.
Now that we know that the checksum facility actually works and fails when
given the wrong checksum, install the right checksum. Ahem.
2019-05-09 00:46:11 +02:00
Dimitri Fontaine
ede385bce7 Upgrade travis testing to SBCL 1.5.2.
That's needed for current ironclad.
2019-05-09 00:36:58 +02:00
Dimitri Fontaine
0643cf0869 Remove the old mention about building the docs in the README.
It's been a while we switched to the Read The Docs format, the ruby-ronn
manpage is a thing of the past now.
2019-05-09 00:28:01 +02:00
Dimitri Fontaine
3118602702 Attempt to add a Read The Docs badge on the GitHub README for pgloader. 2019-05-09 00:26:05 +02:00
Dimitri Fontaine
1be0f02057 Attempt to get Travis back on its feet again.
The current problem with Travis build is that it's using the Quicklisp
version of the cl-db3 librairy rather than the current master's branch
version, which current sources of pgloader depend on.

In the Dockerfiles we use the alternate build method for preparing the lisp
image, and invoke the `make clones` target explicitely in order to make sure
that we have the right set of dependencies at build time.

In this patch we apply the same approach to Travis, hoping to solve the
current build issues there.
2019-05-09 00:18:11 +02:00
Dimitri Fontaine
291af994ba Let's see how those badges look when on the same line. 2019-05-09 00:14:43 +02:00
Dimitri Fontaine
f17562f62c Attempt to add DockerHub Build Status to the README at GitHub. 2019-05-09 00:13:30 +02:00
Dimitri Fontaine
2b6fb3e6c2 Add a casting rule for the I data type in DBF files.
The I data type is mapped to a PostgreSQL integer.

See #929.
2019-05-08 23:36:17 +02:00
Dimitri Fontaine
7d2e5ae941 Allow lambda expression as cast rules using functions.
Before that it was necessary to install a function in the lisp environment
either in the source itself in src/utils/transforms.lisp, or in a lisp file
loaded with --load-lisp-file (or -l for shorts).

While this could be good enough, sometimes a very simple combination of
existing features is required to transform a function and so doing some
level of lisp coding directly in the load command is a nice to have.

Fixes #961.
2019-05-08 19:02:18 +02:00
Mathieu Santostefano
6aa42ec68f Remove invalid WITH default option (#960)
It seems like `create schema` option for WITH statement is invalid.
2019-05-07 23:06:02 +02:00
Dimitri Fontaine
b1d55e07d6 Implement header parsing for fixed file formats.
Fixed file formats might contain an header line with column names and a hint
of the size of each column. While it might be a long shot that we can
acutally use that as a proper fixed-format specification, this patch
implements a guess mode that also outputs the parsed header.

In case when the parsing is wrong in some level of details, it might
actually be a good start to copy/paste from the command output and go from
there.

Fixes #958.
2019-05-07 22:57:55 +02:00
Dimitri Fontaine
27b1a83b9f Allow quoted table and column names in user-defined CASTing rules.
Fixes #955.
2019-04-30 16:55:26 +02:00
Dimitri Fontaine
d4369cc605 Move DB3 transformations function in pglaoder.transforms package.
That makes them available for user defined cast rules.

Fix #929.
2019-04-29 16:52:24 +02:00
Dimitri Fontaine
febb2c11be Update HTTP/ZIP/DBF test case.
The URL of the test case source has changed. Use the new one. Also set the
encoding properly, the client_encoding trick has been deprecated for awhile
now, as pgloader only talks to Postgres in UTF-8.
2019-04-28 23:34:31 +02:00
Dimitri Fontaine
6dbe62af1c Attempt to fix MS SQL drop view for Mat Views facility.
It seems that the current open-coding of the materialized views data
structure is still causing some confusion, so use the same code as in the
MySQL support in the MS SQL parts of the code when trying to fix #950.

See #950.
2019-04-28 22:53:08 +02:00
Dimitri Fontaine
70b6845852 Apply identifier case to MS SQL column names in fkey definitions.
This is a blind fix: it looks like we forgot to take care of identifier case
when adding columns to foreign key definitions in MS SQL catalogs.

Fixes #953.
2019-04-28 22:48:07 +02:00
Dimitri Fontaine
513455f552 Implement support for MySQL bitstrings.
We migrate bit(xx) to the same PostgreSQL datatype bit(xx) where in Postgres
we can use bitstring as documented at the following URL. In particular the
COPY syntax accepts the notation Xabcd for the values, which is quite nice
when MySQL sends the data to us a a byte vector:

  https://www.postgresql.org/docs/current/datatype-bit.html

Fixes #943.
2019-04-19 12:52:04 +02:00
Dimitri Fontaine
a9133256a7 Change the main Dockerfile for sbcl to use make save too.
That building script does not rely on buildapp, which might be an advantage
in docker environments: first it's one less dependency, second, we have seen
weird error cases when using buildapp.
2019-04-17 14:56:54 +03:00
Dimitri Fontaine
739be3a730 Fix Dockerfile.ccl
Stop installing sbcl in the CCL image, that's not needed, and also make sure
we use a git clone of some of the libs rather than the current QL version of
them.

Fixes #926.
2019-04-17 14:51:11 +03:00
Dimitri Fontaine
4b9cbcbce3 Fix MySQL processing of Mat Views, again.
The previous fix left to be desired in that it didn't update the code
expectations about what a view-name looks like in fetch-metadata. In
particular we would use (cons NIL "table-name") in the only-table facility,
which expects non qualified names as strings.

Switch to using the :including filters facility instead, as we do in MS SQL.
Later, we might want to deprecate our internal :only-tables facility.

Fix #932. Again.
2019-04-15 23:06:57 +02:00
Dimitri Fontaine
1a4ce4fb46 Re-indent block before editing.
It turns out that current Emacs settings aren't agreeing with the file
indenting, let's clean that up before modifying the file, so that later
reviews are easier.
2019-04-15 23:05:28 +02:00
Dimitri Fontaine
701d54bfdf Bypass using buildapp in the Docker build for CCL. 2019-04-15 12:23:49 +02:00
Dimitri Fontaine
bc1167d3e3 Implement support for DB3 MEMO files.
The support code is actually found in cl-db3, the changes that are necessary
for pgloader are only about updating to the new API.

Fixes #926.
2019-04-14 22:22:33 +02:00
Dimitri Fontaine
7b10fabd94 Update DB3 documentation to include user-defined casting rules.
See #927, #938.
2019-04-14 21:56:04 +02:00
Dimitri Fontaine
39fc78e08f Implement user-defined casting rules support for DB3.
The casting support for DB3 was hand-crafted and didn't get upgraded to
using the current CAST grammar and facilities, for no other reasons than
lack of time and interest. It so happens what implementing it now fixes two
bug reports.

Bug #938 is about conversion defaulting to "not null" column, and that's due
to the usage of the internal pgloader catalogs where the target column's
nullable field is NIL by default, which doesn't make much sense. With
support for user-defined casting rules, the default is nullable columns, so
that's kind of a free fix.

Fixes #927.
Fixes #938.
2019-04-14 21:46:04 +02:00
Dimitri Fontaine
efe70ba3c3 Fix MySQL Materialized Views support, recently broken.
When adding support for Mat Views to MS SQL, we added support for the view
names to be fully qualified (with their schema), using a cons to host
the (schema . name) data.

Well, turns out the MySQL side of things didn't get the memo.

Blind attempt at fixing #932, see also #918.
2019-04-14 00:37:40 +02:00
Dimitri Fontaine
c83a0375a0 Fix glitch in Materialized Views support for MSSQL.
Thanks to @sorix6 for a bug report with a fix!

Fixes #928.
2019-04-14 00:23:37 +02:00
Dimitri Fontaine
957caa877e Add a new transform function for byte-vector to hexadecimal string.
In some cases when migrating from MySQL we want to transform data from
binary representation to an hexadecimal number. One such case is going from
MySQL binary(16) to PostgreSQL UUID data type.

Fixes #904.
2019-03-18 14:21:33 +01:00
Dimitri Fontaine
4d005b5c9c Improve Postgres connection string parsing.
Add support for single-quoting database name as in the Postgres
documentation about connection string at:

  https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-CONNSTRING

In passing, allow for ipv6 as well as ipv4 host ip addresses.

Fixes #923.
2019-03-17 17:25:41 +01:00
Andreas Hildebrandt
4ec8613884 Correctly parse PostgreSQL version string on Windows.
The regex used in parse-postgresql-version-string failed to handle
"PostgreSQL 10.6, compiled by Visual C++ build 1800, 64-bit"
correctly.
2019-02-25 15:48:40 +01:00
Dimitri Fontaine
0081fb6560 Oops, fix trailing closing parens.
When using interactive recompiling of the code in Emacs/SLIME, extra closing
parens are just ignored in Emacs before sending the current form to the CL
compiler. When compiling from the source files, of course, that doesn't
work.

See #910.
2019-02-19 12:50:56 +01:00
Dimitri Fontaine
fbdc95ede6 Fix parsing of MS GUID with mixed endianness.
It turns out that MS SQL Server is using its own representation for GUID
with a mixed endianness. In this blind patch we attempt to parse the binary
vector in the right way when building our internal representation of an
UUID, before making a string out of it for Postgres, which doesn't use the
same mixed-endianness format.

Fixes #910. Maybe?
2019-02-18 19:37:42 +01:00
Dimitri Fontaine
7c146c46b9 Citus support small bug fixes.
When calling the create_distributed_table() function, the column name is
given as a literal parameter to the function and should be quoted that way,
with single quotes. In particular, if our column-name is already
double-quoted, we need to get rid of those extra quotes.

Also, the source-table-name might be a cons object when qualified, or a
plain string when not schema-qualified. Adjust the citus-find-table code to
take that into account.
2019-02-16 15:48:46 +01:00
Dimitri Fontaine
2e6a941d25 Restore --list-encodings option.
It got broken, somehow. Let's move it further up the chain of command line
option processing.

Fixed #909.
2019-02-15 21:18:38 +01:00
Dimitri Fontaine
69d9b381dc Fix previous patch: also process the bad row.
The bad row needs to go to the reject file, and its condition error message
to the reject log. Ooops, forgot.

See #836.
2019-02-15 00:07:39 +01:00
Dimitri Fontaine
632f7f5b4e Implement COPY error handling for non-parsable error messages.
pgloarder parses the COPY error messages to find out the line number where
we have a problem in the batch, allowing for a quite efficient recovery
mechanism where it's easy enough to just skip the known faulty input.

Now, some error messages do not contain a COPY line number, such as fkey
violation messages:

  Database error 23503: insert or update on table "produtos" violates
  foreign key constraint "produtos_categorias_produtos_fk"

In that case rather than failing the whole batch at once (thanks to the
previous commit, we used to just badly fail before that), we can retry the
batch one row at a time until we find our culprit, and then continue one
input row at a time.

Fixes #836.
2019-02-15 00:05:47 +01:00
Dimitri Fontaine
8eea90bb51 Improve Foreign Key error handling.
We don't know how to parse the PostgreSQL condition sent when there is a
fkey error... and the message would not contain the row number where that
error happened anyway.

At the moment it means that the retry-batch facility errors out for failing
to realize that NIL isn't a number on which we can do arithmetic, which in
itself in a little sad.

In this patch we install a condition handler that knows how to deal with
retry-batch failing, so that pgloader may try and continue rather than
appear locked to the user, when I suspect that the debugger is waiting for
input.

See #836, where that's the first half of the fix. The real fix is to handle
foreign key errors correctly of course.
2019-02-14 23:10:12 +01:00
Dimitri Fontaine
2cbf716112 Ensure column names are double-quoted in the COPY command.
In some cases we have to quote column names and it's not been done yet, for
instance when dealing with PostgreSQL as a source database.

Patch mostly from @m0n5t3r, only cosmetic changes applied. Thanks!

Fixes #905.
2019-02-14 22:16:53 +01:00
Dimitri Fontaine
0caa9c30ce Fix Postgres to Postgres migrations with schema name change.
When migrating from PostgreSQL, pgloader takes the index and foreign key
definitions from the server directly, using pg_get_indexdef() and other
catalog functions. That's very useful in that it embeds all the necessary
quoting of the objects, and schema-qualify them.

Of course we can't use the SQL definition as on the source system when we
target a schema name that is different from the source system, which the
code didn't realize before this patch. Here we simply invalidate the
pre-computed SQL statement and resort to using the classic machinery to
build the statement from pieces again.

Fixes #903.
2019-02-14 18:24:50 +01:00
Dimitri Fontaine
213edbe930 Compare type names case-insensitively in casting rules.
The types TEXT and text are the same, and should match both when used as a
casting rule and when checking a catalog merge.

See #132.
2019-02-05 18:26:40 +03:00
ChristophKaser
36fbadded6 Allow "preserve index names" for MSSQL (#902)
With this change, preserve index names is also supported for MSSQL-connections.
2019-02-05 11:08:23 +03:00
Christoph Berg
a6df4e9807 debian/rules: Sync loaded systems with Makefile.
Cf. 25c937879a
2019-01-22 10:42:56 +01:00
Christoph Berg
398802a1f0 debian/tests/ssl: Add --debug to get backtraces.
Cf. #893.
2019-01-21 22:03:35 +01:00
William Hakizimana
be2815fda2 Typo: Change issing to issuing (#895) 2019-01-21 18:13:52 +01:00
Dimitri Fontaine
eafaf80b3c Back to non-release development.
Master's branch is now preparing for 3.6.2.
2019-01-21 17:51:44 +01:00
William Hakizimana
3208145e46 Typo: change directly to directory (#894) 2019-01-21 17:50:30 +01:00
Christoph Berg
15106489d6 New upstream version.
* New upstream version.
* SSL is always enabled now, drop our patch.
* Add B-D on python3-sphinx-rtd-theme.
2019-01-21 16:19:50 +01:00
Christoph Berg
de38a4473a Merge branch 'master' into debian 2019-01-21 16:09:05 +01:00
Dimitri Fontaine
25c937879a Fix building for 3.6.1.
The pgloader-image feature must be added in the lisp image before
reading/compiling the pgloader sources for it to be useful.
2019-01-21 15:02:39 +01:00
Dimitri Fontaine
dae5dec03c Allow fields/columns projections when parsing header.
When using a CSV header, we might find fields in a different order than the
target table columns, and maybe not all of the fields are going to be read.
Take account of the header we read rather than expecting the header to look
like the target table definition.

Fix #888.
2019-01-15 22:39:08 +01:00
Dimitri Fontaine
1306b4c953 Desultory improvements.
Killing tasks in the error handling must be done carefully, and given this
testing session it seems better to refrain from doing it when erroring out
at COPY init time (missing column is an example of that). The approach
around that is still very much ad-hoc rather than systematic.

In passing improve the `make save` option to producing a binary image: have
the make recipe respect the CL variable. The command line options
differences were already accounted for.
2019-01-09 18:57:33 +01:00
Dimitri Fontaine
2147a1d07b Implement ALTER TABLE ... SET TABLESPACE ... as a pgloader clause.
This allows creating tables in any target tablespace rather than the default
one, and is supported for the various sources having support for the ALTER
TABLE clause already.
2019-01-08 22:50:24 +01:00
Dimitri Fontaine
f28f8e577d Review log-level for stored procedures.
Some MySQL schema level features (on update current_timestamp) are migrated
to stored procedures and triggers. We would log the CREATE PROCEDURE
statements as LOG level entries instead of SQL level entries, most likely a
stray devel/debug choice.
2019-01-08 22:44:07 +01:00
Dimitri Fontaine
44514deaa7 Improve ALTER TABLE documentation. 2019-01-08 22:09:13 +01:00
Dimitri Fontaine
a4a52db594 Improve SQLite support for autoincrement and sequences.
It turns out that SQLite only creates an entry in its sqlite_sequence
catalogs when some data make it to a table using a sequence, not at create
table time. It means that pgloader must do some more catalog querying to
figure out if a column is "autoincrement", and apparently the only way to
get to the information is to parse the SQL statement given in the
sqlite_master table.

Fixes #882.
2019-01-07 23:52:29 +01:00
Dimitri Fontaine
204a0119cd Add another debugging guard #+pgloader-image. 2019-01-07 23:51:58 +01:00
Dimitri Fontaine
e4a4edb276 Make interactive debugging easier.
It's fair game to handle errors and issue logs instead when using the
pgloader binary image, as it distracts users a lot. That said, as a
developer the interactive debugger is very useful.

In passing install some experimental thread killing behavior in case of
errors and using on-error-stop setting (default for database migrations).
2019-01-07 20:44:16 +01:00
Dimitri Fontaine
9ce4088b48 Improvements to the make save facility. 2019-01-07 20:44:16 +01:00
Stéphane Wirtel
13bdb2d118 Fix section in rest (#883) 2019-01-07 20:24:59 +01:00
Dimitri Fontaine
b8e8cf7d18 Fix bugs in the recent extended support for materialized views.
Materialized views without an explicit schema name are supported, but then
would raise an error when trying to use destructuring-bind on a string
rather than the (cons schema-name table-name). This patch fixes that.
2018-12-28 10:53:01 +01:00
Dimitri Fontaine
65d323e4a3 Refrain from matching typemod expression to NIL typemod.
Fixes #879.
2018-12-23 20:51:36 +01:00
Dimitri Fontaine
3d08996777 Review the new documentation material. 2018-12-20 10:05:54 +01:00
Dimitri Fontaine
eab1cbf326 More docs improvements.
Explain the feature list of pgloader better for improving discoverability of
what can be achieved with our nice little tool.
2018-12-19 22:40:32 +01:00
Dimitri Fontaine
ec071af0ad Add a Feature Matrix to the documentation.
That helps having both an overview of what pgloader is capable of doing with
a database migration, and also documenting that some sources don't have the
full support for some features yet.
2018-12-19 15:31:25 +01:00
Dimitri Fontaine
2cafa8360c Document newly added MATERIALIZE VIEWS for new sources.
Now it's possible to use this clause with a PostgreSQL or an MS SQL database
source.

Fixes #817.
2018-12-19 10:51:04 +01:00
Dimitri Fontaine
c019c16113 Implement MATERIALIZE VIEWS support for MS SQL, and distribute.
The latter is not tested yet, but should have no impact if not used. Given
how rare it is that I get a chance to play around with a MS SQL instance
anyway, it might be better to push blind changes for it when it doesn't
impact existing features…
2018-12-19 01:25:27 +01:00
Dimitri Fontaine
bda06f8ac0 Implement Citus support from a MySQL database. 2018-12-17 16:31:47 +01:00
Dimitri Fontaine
290ad68d61 Implement materialize views in PostgreSQL source support. 2018-12-16 23:17:37 +01:00
Dimitri Fontaine
007003647d Improve Redshift support documentation. 2018-12-14 18:21:34 +09:00
Dimitri Fontaine
f72afeeae7 Switch the documentation to the ReadTheDocs template. 2018-12-12 09:34:20 +09:00
Dimitri Fontaine
b6de8f1ead Improve Citus documentation. 2018-12-12 09:34:05 +09:00
Dimitri Fontaine
56d24de67a Update documentation with new features.
We have a lot of new features to document. This is a first patch about that,
some more work is to be done. That said, it's better than nothing already.
2018-12-11 14:25:08 +09:00
Dimitri Fontaine
af2995b918 Apply quoting rules to SQLite index column names.
The previous fix was wrong for missing the point: rather than unquote column
names in the table definition when matching the column names in the index
definition, we should in the first place have quoted the index column names
when needed.

Fixes #872 for real this time.
2018-12-02 00:17:26 +01:00
Dimitri Fontaine
a939d20dff Unquote names when searching for an index column name in its table.
If the source database is using a keyword (such as "order") as a column
name, then pgloader is going to quote this column name in its internal
catalogs. In that case, unquote the column in the pgloader catalogs when
matching it against the unquoted column name we have in the index
definition.

Fixes #872.
2018-12-01 21:27:26 +01:00
Dimitri Fontaine
ab2cadff24 Simplify the regular expresion parsing the PostgreSQL version string.
The debian/Ubuntu packaging would defeat the quite simple regexp parsing
PostgreSQL version string that we have in pgloader. To make it more robust,
make it more open to unforeseen strings.

See #800, see #810.
2018-11-30 15:39:27 +01:00
Dimitri Fontaine
801d8a6e09 Add support for MS SQL time data type.
As for the other datetime types we have to use CONVERT at the SQL level in
order to get a format that PostgreSQL understands. This time the magic
number for it is 114.
2018-11-23 10:43:58 +01:00
Dimitri Fontaine
6e325f67e0 Implement the save.lisp idea for the bundle.
This should make it easier to build pgloader with CCL rather than SBCL, all
from the bundle distribution, and also easier to support windows.

In passing, add a new file in the bundle distribution: version.sexp should
contain a CL string containing the pgloader version string.
2018-11-21 21:44:56 +01:00
Dimitri Fontaine
18bcf10903 Blind fix for a strange use-case.
A user reported a case where pgloader fails to find the table an index has
been created on in pgloader catalogs. That's a weird case. For now, just
issue a warning about the situation and skip the index.
2018-11-21 18:17:34 +01:00
Dimitri Fontaine
4ab26e5387 Handle other conditions in process-catalogs.
It might be that some random condition is signaled during process-catalogs,
causing the errors reported so far and that I can't reproduce. Let's add
some handler-case protection to have more clues about what could be
happening.

See #865, #800, #810, #859, #824.
2018-11-21 17:31:11 +01:00
Dimitri Fontaine
743769d750 Improve handling of errors when fetching the source catalogs.
We might have MS SQL failures at this stage, or even Redshift or other
PostgreSQL variants failing to execute our catalog queries. Handle
conditions by cleanly logging them and returning from copy-database without
doing anything. That's the best we can do here.

Fixes #605, fixes #757.
2018-11-21 10:38:19 +01:00
Dimitri Fontaine
1c18b41cd7 Implement a new way of building pgloader: make save.
This time we directly call into the save-lisp-and-die feature of the
implementation. As pgloader only supports SBCL and CCL at the time being,
doing things without an abstraction layer is easy enough.

This needs more testing and a special version for the bundle case too. One
step at a time, etc.
2018-11-20 22:59:43 +01:00
Dimitri Fontaine
3f2f10eef1 Finish implementation of CAST rules for PostgreSQL source databases.
Add a link to the table from the internal catalogs for columns so that we
can match table-source-name in cast rules when migrating from PostgreSQL.
2018-11-19 19:33:37 +01:00
Dimitri Fontaine
aa8ae159e2 Improve error handling when applying Citus distribution rules.
Make it so that we generate a proper error message to the user when failing
to figure out the PATH to the distribution key, rather than failing with an
internal error about The value NIL is not of type PGLOADER.CATALOG:TABLE.
2018-11-18 18:21:51 +01:00
Dimitri Fontaine
f07ac61269 Fix default/serial handling of pgsql as a source.
In the recent patch that added support for Redshift "identity" columns, we
broke support for PostgreSQL sequences. Unbreak that.
2018-11-18 17:46:41 +01:00
Dimitri Fontaine
1fd0576ace Fix Citus support related debug print instructions. 2018-11-16 00:08:27 +01:00
Dimitri Fontaine
8b1acbae87 Make sure the image knows how to print circular data structures.
Our catalogs representation is designed to be circular, which helps
navigating the graph from anywhere when processing it. This means that we
need to have *print-circle* set to t in the pgloader image, otherwise we
might run into Control stack exhausted when trying to print out debug
information...

Fixes #865, #800, #810, #859, #824.
2018-11-16 00:03:31 +01:00
Dimitri Fontaine
e291c502ba Install a call to cl+ssl:reload at image startup time, again.
Testing shows that it's not just debian which needs it, it's always
necessary. Just re-add our tweak now.

See #866, see #816, see #807, #794.
2018-11-15 23:59:51 +01:00
Dimitri Fontaine
16dda01f37 Deal with SSL verify error the wrong way.
This patch adds an option --no-ssl-cert-verification that allows bypassing
OpenSSL server certificate verification. It's hopefully a temporary measure
that we set up in order to make progress when confronted to:

  SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY

The real solution is of course to install the SSL certificates at a place
where pgloader will look for them, which defaults to
~/.postgresql/postgresql.crt at the moment. It's not clear what the story is
with the defaults from /etc/ssl, or how to make things happen in a better
way.

See #648, See #679, See #768, See #748, See #775.
2018-11-15 00:13:21 +01:00
Dimitri Fontaine
5ecf04acb9 Implement null if support as a WITH option.
This gives a default "null if" option to all the input columns at once, and
it's still possible to override the default per column.

In passing, fix project-fields declarations that SBCL now complains about
when they're not true, such as declaring a vector when we might have :null
or nil. As a result, remove the (declare (optimize speed)) in the generated
field processing code.
2018-11-13 21:41:27 +01:00
Dimitri Fontaine
a6ef7a56a9 Implement ipv6 hostname support in .pgpass rules.
An hostname could be written [::1] in .pgass, without having to escape the
colon characters, and with a proper enclosing in square brackets, as common
for ipv6 addresses.

Fixes #837.
2018-11-10 21:01:30 +01:00
Dimitri Fontaine
656bf85075 Review field to column projection code emitted.
The code emitted by pgloader to transform input fields into PostgreSQL
column values was using too many optimization declarations, some of them
that SBCL failed to follow through for lack of type marking in the generated
code.

As SBCL doesn't have enough information to be optimizing anyway, at least we
can make it so that we don't have a warning about it. The new code does that.

Fixes #803.
2018-11-10 20:22:04 +01:00
Dimitri Fontaine
6eaad0621b Desultory code maintenance for MS SQL identity support.
The code expects the keyword :auto-increment rather than a string nowadays
in order to process an extra column bits of information as meaning that we
want to cast to a serial/bigserial datatype.
2018-11-09 22:42:31 +01:00
Dimitri Fontaine
6c80404249 Implement support for Redshift "identity" columns.
At this stage we don't even parse the details of the Redshift identity such
as the seed and step values and consider them the same as a MySQL
auto_increment extra description field.

Fixes #860 (again).
2018-11-09 22:41:14 +01:00
Dimitri Fontaine
794bc7fc64 Improve redshift support: string_agg() doesn't exist there.
Neither does array_agg(), unnest() and other very useful PostgreSQL
functions. Redshift is from 8.0 times, so do things the old way: parse the
output of the index definition that get from calling pg_index_def().

For that, this patch introduces the notion of SQL support that depends on
PostgreSQL major version. If no major-version specific query is found in the
pgloader source tree, then we use the generic one.

Fixes #860.
2018-11-07 21:23:56 +01:00
Dimitri Fontaine
207cd82726 Improve SQLite type names parsing.
Allow spaces in more random places, as SQLite doesn't seem to normalize the
user input. Fixes #548 again.
2018-11-07 11:01:06 +01:00
Dimitri Fontaine
f8460c1705 Allow usernames and dbnames starting with digits (again).
It turns out that the rules about the names of users and databases are more
lax than pgloader would know, so it might be a good move for our DSN parsing
to accept more values and then let the source/target systems to complain
when something goes wrong.

See #230 which got broke again somewhere.
2018-10-20 19:28:19 +02:00
Jason Rigby
6e7ea90806 add cl-ironclad and cl-babel dependencies to docker builds (#854) 2018-10-18 18:56:40 +02:00
Larry Gebhardt
0e6f599282 Add Docker build instructions (#853) 2018-10-18 18:55:56 +02:00
Dimitri Fontaine
7b487ddaca Add a Citus distribution test case, from the citus tutorial. 2018-10-18 15:42:17 +02:00
Dimitri Fontaine
d3b21ac54d Implement automatic discovery of the Citus distribution rules.
With this patch, the following distribution rule

   distribute companies using id

is equivalent to the following distribution rule set, given foreign keys in
the source schema:

   distribute companies using id
   distribute campaigns using company_id
   distribute ads using company_id from campaigns
   distribute clicks using company_id from ads, campaigns
   distribute impressions using company_id from ads, campaigns

In the current code (of this patch) pgloader walks the foreign-keys
dependency tree and knows how to automatically derive distribution rules
from a single rule and the foreign keys.
2018-10-18 15:31:29 +02:00
Dimitri Fontaine
8112a9b54f Improve Citus Distribution Support.
With this patch it's now actually possible to backfill the data on the fly
when using the "distribute" new commands. The schema is modified to add the
distribution key where specified, and changes to the primary and foreign
keys happen automatically. Then a JOIN is generated to get the data directly
during the COPY streaming to the Citus cluster.
2018-10-16 18:53:41 +02:00
Dimitri Fontaine
760763be4b Use the constraint name when we have it.
That's important for Citus, which doesn't know how to ADD a constraint
without a name.
2018-10-10 15:44:21 -07:00
Dimitri Fontaine
381ac9d1a2 Add initial support for Citus distribution from pgloader.
The idea is for pgloader to tweak the schema from a description of the
sharding model, the distribute clause. Here's an example of such a clause:

   distribute company using id
   distribute campaign using company_id
   distribute ads using company_id from campaign
   distribute clicks using company_id from ads, campaign

Given such commands, pgloader adds the distibution key to the table when
needed, to the primary key definition of the table, and also to the foreign
keys that are pointing to the changed primary key.

Then when SELECTing the data from the source database, the idea is for
pgloader to automatically JOIN the base table with the source table where to
find the distribution key, in case it was just added in the schema.

Finally, pgloader also calls the following Citus commands:

  SELECT create_distributed_table('company', 'id');
  SELECT create_distributed_table('campaign', 'company_id');
  SELECT create_distributed_table('ads', 'company_id');
  SELECT create_distributed_table('clicks', 'company_id');
2018-10-10 14:35:12 -07:00
Dimitri Fontaine
344d0ca61b Implement AFTER SCHEMA sql code blocks.
This allows pgloader users to run SQL commands in between pgloader's schema
creation and the actual loading of the data.
2018-10-10 11:08:28 -07:00
Jon Snell
0957bd0efa Fix pgloader bug #844 by adding support for mssql real types (#845) 2018-10-05 12:47:54 +02:00
Dimitri Fontaine
d356bd501b Accept even more ragged date format input.
When parsing a date string from a date format, accept that the ms or us part
be completely missing, rather than just missing some digits.

Fixed #828.
2018-09-10 19:37:36 +02:00
Dimitri Fontaine
5119d864f4 Assorted bug fixes in the context of Redshift support as a source.
The catalog queries used in pgloader have to be adjusted for Redshift
because this thing forked PostgreSQL 8.0, which is a long time ago now.
Also, we had a couple bugs here and there that were not really related to
Redshift support but were shown in that context.

Fixes #813.
2018-09-04 11:49:21 +02:00
Dimitri Fontaine
0f58a3c84d Assorted fixes: catalogs SQLtypes and MySQL decoding as.
It turns out that when trying to debug "decoding as" the SQLtype listing
support in sqltype-list was found broken, so this patch fixes it. Then goes
on to fix the DECODING AS filters support, which we have switched to using
the better regexp-or-string filter struct but forgot to update the matching
code accordingly.

Fixes #665.
2018-08-31 22:51:41 -07:00
Dimitri Fontaine
4fbfd9e522 Refrain from using regexp_match() function, introduced in Pg10.
Instead use the substring() function which has been there all along.

See #813.
2018-08-22 10:52:01 +02:00
Dimitri Fontaine
c9b905b7ac Simplify our ASD system definition by using :serial t.
This allows to drop manually maintained list of files dependencies, instead
implying them by the order in which we list the files.
2018-08-20 11:55:47 +02:00
Dimitri Fontaine
cb633aa092 Refrain from some introspections on non-PGDG PostgreSQL variants.
When dealing with PostgreSQL protocol compatible databases, often enough
they don't support the same catalogs as PostgreSQL itself. Redshift for
instance lacks foreign key support.
2018-08-20 11:52:59 +02:00
Dimitri Fontaine
d3bfb1db31 Bugfix previous commit: filter list format changed.
We now accept the more general string and regex match rules, but the code to
generate including and excluding lists from the catalogs had not been updated.
2018-08-20 11:50:50 +02:00
Dimitri Fontaine
fc3a1949f7 Add support for PostgreSQL as a source database.
It's now possible to use pgloader to migrate from PostgreSQL to PostgreSQL.
That might be useful for several reasons, including applying user defined
cast rules at COPY time, or just moving from an hosted solution to another.
2018-08-20 11:09:52 +02:00
Dimitri Fontaine
1ee389d121 Fix parsing empty hostname fields in pgpass.
Fixes #823.
2018-08-14 10:07:05 +03:00
uniquestring
34cc25383a Improved Dockerfiles/docker image size (#821)
* Add dockerfiles to .dockerignore

Otherwise changes in the dockerfiles would invalidate the cache

* Rewrite Dockerfile

- Fix deprecated MAINTAINER instruction
- Move maintainer label to the bottom (improving cache)
- Tidy up apt-get
- Use COPY instead of ADD
  see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy
- Remove WORKDIR instruction (we don't really need this)
- Combine remaining RUN layers to reduce layer count
- Move final binary instead of copying (reduce image size)

* Use -slim image an multistage build

Reduce size by using multistage builds and the -slim image.
Use debian:stable instead of an specific code name (future proof).

* [cosmetic] indent Dockerfile instructions

Make it easier to see where a new build stage begins

* Rewrite Dockerfile.ccl

Apply the same changes to Dockerfile.ccl as we did for Dockerfile
2018-08-11 01:08:00 +02:00
Christoph Berg
1a811707c6 releasing package pgloader version 3.5.2-3 2018-07-31 16:24:41 +02:00
alexknips
5ca3ee8aad Fix documentation of default MySQL cast rules (#815)
The default rule is `type int to bigint    when  (>= 10 precision)`.
2018-07-20 14:38:06 +02:00
Dimitri Fontaine
46d14af0d3 Add more default rules to MySQL datetime handling.
Given the variety of ways to setup default behavior for datetime and
timestamp data types in MySQL, we need yet more default casting rules. It
might be time to think about a more principled way to solve the problem, but
on the other hand, this ad-hoc one also comes with full overriding
flexibility for the end user.

Fixes #811.
2018-07-08 20:37:06 +02:00
Christoph Berg
1844823bce Rename regress test to ssl
And move ca-certificates dependency to correct test
2018-07-05 21:52:54 +02:00
Christoph Berg
a199db1ae4 Debian: Make cl-pgloader test depend on ca-certificates
Make cl-pgloader test depend on ca-certificates so the snakeoil certificate is
recognized as a valid CA. (Needs the /etc/ssl/certs/*.0 file.)
2018-07-05 19:07:56 +02:00
Dimitri Fontaine
1b150182dc Fix cl-csv delimiter type.
Travis spotted a bug with CCL that I failed to see, and that happens with
Clozure-CL but not with SBCL apparently:

2018-07-03T21:04:11.053795Z FATAL The value "\\\"", derived from the initarg :DELIMITER, can not be used to set the value of the slot CL-CSV::DELIMITER in #<CL-CSV::READ-DISPATCH-TABLE-ENTRY #x30200143DDCD>, because it is not of type (VECTOR (OR (MEMBER T NIL) CHARACTER)).

To fix, prefer the syntax #(#\\ #\") rather than "\\\"".
2018-07-04 01:32:40 +02:00
Christoph Berg
4eb8c7367f releasing package pgloader version 3.5.2-2 2018-07-03 22:53:02 +02:00
Christoph Berg
852b3bc888 debian: Test cl-pgloader through sbcl --eval. 2018-07-03 22:49:27 +02:00
Christoph Berg
647bf4cb86 debian/rules: invoke help2man without path 2018-07-03 22:22:01 +02:00
Christoph Berg
d46c3b8c59 debian/rules: Properly format buildapp invocation 2018-07-03 20:16:29 +02:00
Christoph Berg
bba850479b debian: Skip building and manpage generation in arch-indep builds. 2018-07-03 20:13:15 +02:00
Christoph Berg
ded148228d debian: Install pgloader.asd into correct location. (Closes: #857226) 2018-07-03 18:48:04 +02:00
Christoph Berg
4f5e426fc7 debian: #864309 was fixed in 3.5.2-1 2018-07-03 18:27:51 +02:00
Christoph Berg
8263e587f0 debian/source/options: Ignore changes in src/params.lisp (release vs non-release). 2018-07-03 17:17:28 +02:00
Christoph Berg
906fd96bf1 debian: Build manpage using help2man. 2018-07-03 17:13:35 +02:00
Christoph Berg
b4fae61d41 debian/copyright: syntax fixups 2018-07-03 17:13:35 +02:00
Dimitri Fontaine
8537bd661f Back to not being a release.
Maybe I should find a way to avoid this extra back-and-forth commit.
Someday.
2018-07-03 17:11:38 +02:00
Dimitri Fontaine
63af7e7373 Release 3.5.2.
This release fixes debian packaging, includes support for Redhift as a
target, and also fixes some bugs.
2018-07-03 16:58:55 +02:00
Christoph Berg
cb528c2e19 All included test data has been verified as free, stop building a +dfsg tarball. 2018-07-03 16:37:43 +02:00
Christoph Berg
f19e301c81 debian: Build sphinx docs
While we are at it, remove built docs on clean
2018-06-25 15:02:32 +02:00
Christoph Berg
7a974d712e docs: Remove sidebar_collapse: false
Sphinx's alabaster module on Debian stretch doesn't support
sidebar_collapse yet; remove the setting so the docs build everywhere
2018-06-25 14:48:29 +02:00
Christoph Berg
a1d42028a3 Build and install new sphinx docs instead. 2018-06-25 12:47:20 +02:00
Dimitri Fontaine
9661c5874d Fix previous patch.
It's easy to avoid having the warning about unused lexical variable with the
proper declaration, that I failed to install before because of a syntax
error when I tried. Let's fix it now that I realise what was wrong.
2018-06-23 00:50:35 +02:00
Dimitri Fontaine
8930734bea Ensure unquoted file names for logs and data.
The previous code could create files having as an example the following,
unhelpful name: \"errors\"/\"err\".\"errors\".log.

Fix #808.
2018-06-22 23:02:07 +02:00
Christoph Berg
ee44f19815 debian: Enable SSL in src/hooks.lisp. 2018-06-22 14:35:59 +02:00
Christoph Berg
2160d0abb2 debian: force SSL usage in test via PGSSLMODE 2018-06-22 14:25:12 +02:00
Dimitri Fontaine
047cf84341 Add support for PGSSLMODE environment variable.
PostgreSQL supports many environment variable to drive its connection
behavior, as documented at the following reference:

  https://www.postgresql.org/docs/current/static/libpq-envars.html

We don't yet support everything, adding them one piece at a time.
2018-06-22 14:13:15 +02:00
Christoph Berg
7b4821e26c debian: Depend on the libssl version cl-plus-ssl depends on. 2018-06-22 10:55:16 +02:00
Christoph Berg
eaf3370a16 debian/rules: remove orig target 2018-06-22 10:30:32 +02:00
Christoph Berg
ae26ca5c1d debian: remove debian/home on clean 2018-06-22 10:15:20 +02:00
Christoph Berg
12af803612 debian: test installed pgloader binary 2018-06-22 10:13:32 +02:00
Christoph Berg
20e5b0bf2a debian/tests: Depend on postgresql, and run test as root
Prepare to test SSL connections, but do not exercise the test yet,
cl-plus-ssl is still broken.
2018-06-21 15:36:52 +02:00
Dimitri Fontaine
7d8ac3b352 Reproduce a test case from issue #795. 2018-06-15 22:14:04 +02:00
Dimitri Fontaine
a0bac47101 Refrain from TRUNCAT'ing an empty list of tables.
Fixed #789.
2018-06-15 17:46:31 +02:00
Dimitri Fontaine
8c2cda75e5 Allow more punctuation signs in the parsers: dollar and percent.
For some reasons some people might use those in their connection strings, as
part of a username or such.

Fixes #809.
2018-06-15 17:26:51 +02:00
Christoph Berg
7220fc2038 debian: Add watch file. 2018-06-04 12:58:35 +02:00
Christoph Berg
0f1da26a27 Run only allcols.load test for now 2018-06-04 12:52:30 +02:00
Christoph Berg
30f90cb848 test/Makefile: Allow configuring the superuser database name
Also, don't ignore errors while setting up the database
2018-06-04 10:52:14 +02:00
Dimitri Fontaine
dfedce2aba Fix support for discovery of DBF target table name.
When the LOAD command does not provide the name of the target table for a
DBF source, we can get the name of the table from the DBF file itself. That
feature got broken, here's a fix.

Fix #805.
2018-06-01 11:23:51 -04:00
Christoph Berg
4cd26c09fd Add new B-D cl-zs3 2018-05-27 21:37:06 +02:00
Björn Häuser
ad7ce4a66b Fix documentation for binary datatype changes (#801)
When reading http://pgloader.readthedocs.io/en/latest/ref/mysql.html I came across the section of binary. On the documentation the indentation is off and is kinda hard to read :)
2018-05-26 13:54:28 +02:00
Dimitri Fontaine
bcf9cf9bf4 Redshift doesn't have support for the COPY format.
Instead, it needs to parse CSV files. On the other hand, as we don't have to
implement the COPY protocol from within pgloader for Redshift (because it's
using S3 as the data source, and not STDIN), we don't need the level of
control that we are using when talking to a normal PostgreSQL.
2018-05-23 13:45:16 +02:00
Dimitri Fontaine
3db3ecf81b Review Redshift data type dumb-down choices.
It's a little more involved that what was done previously. In particular we
need to pay attention to MySQL varchar(x) and transform them into something
big enough when counting bytes rather than chars, like varchar(3x).

Then there's the "text" datatype to take into account, and some more.
2018-05-23 13:43:28 +02:00
Dimitri Fontaine
05b4c7c978 Fix default MySQL casting rules for on update current timestamp.
Due to how type casting matching is implemented in pgloader, we need to add
two more MySQL casting rules in the default pgloader set to handle
specically the case when a datetime or timestamp column in MySQL has the
"extra" bit of information "on update current timestamp".

That's because for a casting rule to match, both the type definition and the
casting rule must have the :on-update-current-timestamp property positionned
the same, so that the existing default rules would not apply.
2018-05-23 10:34:34 +02:00
Dimitri Fontaine
9ac400b623 Implement copying data through S3 for Redshift.
Also add some schema-level support by disabling our usual index and
constraint support when the target is Redshift, because it doesn't support
those parts of SQL.

The S3 parameters are read form either the process environment variables or
from the AWS configuration files in ~/.aws.
2018-05-21 21:22:15 +02:00
Dimitri Fontaine
d4dc4499a8 Add schema migration support for Redshift as a target.
Redshift looks like a very old PostgreSQL (8.0.2) with some extra features
and a very limited selection of data types. In this patch we parse the
PostgreSQL version() function output and automatically determine if we're
connected to Redshift.

When connected to Redshift, we then dumb-down our target catalogs to the
subset of data types that Redshift actually does support.

Also, some catalog queries can't be done in Redshift, and 8.0 didn't have
fully compliant VALUES statement, so we use a temporary table in places
where we used to use SELECT ... FROM (VALUES(...)) in pgloader.

COPYing data to Redshift isn't possible with just this set of changes,
because Redshift also don't support the COPY FROM STDIN form. COPY sources
are limited, and another patch will have to be cooked to prepare the data
from pgloader into a format and location that Redshift knows how to handle.

At least, it's possible to migrate a database schema to Redshift already.
2018-05-19 19:16:58 +02:00
Dimitri Fontaine
8fce6c84fc Move all typemod functions at the same place.
Having the parse-column-typemod function in the pgloader.transforms package
makes it available from everywhere in the pgloader code base.
2018-05-19 19:15:30 +02:00
Dimitri Fontaine
1f354131d0 Release pgloader 3.5.1.
Lots of bug fixes did happen, time to release.
2018-05-17 10:41:40 +02:00
Dimitri Fontaine
f30f596eca Review bundle and regression test facilities.
Some path computation didn't work when trying to regression test the
produced bundle.

Also, the bundle building steps would use the pgloader system definition and
dependencies from what's currently available in Quicklisp rather than from
the local pgloader.asd being built.
2018-05-17 10:39:32 +02:00
Dimitri Fontaine
1fe835d31b Add sample data for fields escaped by double-quote.
See #787.
2018-04-29 19:05:52 +02:00
Dimitri Fontaine
a392328dad Allow any ordering of guards and extra cast rule clauses.
It used to be that extra were forced to being parsed before guards, but
there's no reason why a user wouldn't think to write its clauses the other
way round, so add support for that as well.

See #779.
2018-04-29 19:00:20 +02:00
Dimitri Fontaine
01f877bad7 Testing a change in the way we load CL+SSL.
Apparently cl+ssl needs to be reloaded a very specific way at image startup
time, and provides a function to do just that. Let's try and use this piece
of magic rather cffi:load-foreign-library directly.
2018-04-16 15:46:16 +02:00
Dimitri Fontaine
cb9e01f4d9 Code review for previous commit.
See #771.
2018-03-27 14:55:31 +02:00
Goo
c6271506ab Add a new transformation function: hex-to-dec
Closes #771
2018-03-27 14:51:34 +02:00
Dimitri Fontaine
792c0d0357 Typo fix in docs about concurrency settings. 2018-03-26 14:05:05 +02:00
Dimitri Fontaine
e4dca1a086 Implement support for MySQL useSSL=true|false option.
The MySQL connection string parameter for SSL usage is useSSL, so map an
option name to our expected values for sslmode in database connection
strings.

See #748.
2018-03-16 16:41:40 +01:00
Denis Ivanov
a7fd776ecd Update mssql.rst (#762)
Typo in like word
2018-03-13 17:08:51 +01:00
Andy Chosak
ceb5c85f56 fix minor error in docs about logfile location (#761)
The default logfile location seems to be `/tmp/pgloader/pgloader.log`,
not `/tmp/pgloader.log` as currently documented. This is observable in
practice and also in [the source
code](5b227200a9/src/main.lisp (L110)).
2018-03-13 10:37:48 +01:00
Dimitri Fontaine
3112adea6f Fix date-with-no-separator transform.
The expected string length was hard-coded, which is not a good idea given
the support for custom date formats.
2018-03-07 23:07:00 +01:00
Dimitri Fontaine
42c9ccfbb3 DB3: pick user's choice of schema name when given.
We would hard-code the schema name into the table's name in the DB3 case on
the grounds that a db3/dbf file doesn't have a notion of a schema. But when
the user wants to add data into an existing target table, then we merge the
catalogs and must keep the given target schema and table name.

Fix #701.
2018-02-25 23:39:52 +01:00
Dimitri Fontaine
784aff6ed5 Handle parsing errors in pgpass gracefully.
Accept empty password lines in ~/.pgpass files, and when otherwise pgloader
fails to parse or process the file log a warning and return a nil password.

See #748.
2018-02-25 00:12:06 +01:00
Dimitri Fontaine
bd7eb38720 Review Dockerfiles.
Upgrade to stretch in the docker builds and improve disk footprint to some
degree, using classic docker tricks.

See #748.
2018-02-25 00:00:42 +01:00
Dimitri Fontaine
5c10f12a07 Fix duplicate package names.
In a previous commit we re-used the package name pgloader.copy for the now
separated implementation of the COPY protocol, but this package was already
in use for the implementation of the COPY file format as a pgloader source.

Oops.

And CCL was happily doing its magic anyway, so that I've been blind to the
problem.

To fix, rename the new package pgloader.pgcopy, and to avoid having to deal
with other problems of the same kind in the future, rename every source
package pgloader.source.<format>, so that we now have pgloader.source.copy
and pgloader.pgcopy, two visibily different packages to deal with.

This light refactoring came with a challenge tho. The split in between the
pgloader.sources API and the rest of the code involved some circular
depencendies in the namespaces. CL is pretty flexible here because it can
reload code definitions at runtime, but it was still a mess. To untangle it,
implement a new namespace, the pgloader.load package, where we can use the
pgloader.sources API and the pgloader.connection and pgloader.pgsql APIs
too.

A little problem gave birth to quite a massive patch. As it happens when
refactoring and cleaning-up the dirt in any large enough project, right?

See #748.
2018-02-24 19:24:22 +01:00
Dimitri Fontaine
4301503df2 Add a new test case for {{ENVVAR}} template support.
See #555.
2018-02-20 14:45:07 +01:00
Dimitri Fontaine
48af01dbbc Fix implementation of foreign keys in data only mode.
In data-only mode, the foreign keys parameter (which defaults to True) means
something special: we remove the fkey definitions prior to the data only
load then re-install the fkeys.

This got broken in a previous commit, the WITH clause option being processed
like the other DDL ones that only make sense when creating the schema. While
fixing the setting in copy-database, we have to also fix a nesting bug in
complete-pgsql-database that would prevent fkey to be installed again at the
end of the load.

This patch not only fix that choice, but also review the implementation of
the drop-pgsql-fkeys support function to use more modern internal API,
preparing a list of SQL statements to be sent to the psql-execute level.

Fixes #745.
2018-02-19 22:07:43 +01:00
Dimitri Fontaine
e129e77eb6 Fix SQL execute counters maintenance. 2018-02-19 22:06:51 +01:00
Dimitri Fontaine
957c975b9b Improve summary reporting of errors.
Not all error paths are counted correctly at this point, this commit
improves the situation in passing. A thorough review should probably be
planned sometime.
2018-02-19 22:05:53 +01:00
Dimitri Fontaine
4fed8c5eca Fix support for newid() from MS SQL.
Several places in the code are involved to deal with the default values from
MS SQL. The catalog query is dealing with strange quoting rules on the
source side and used to fill in directly the PostgreSQL expected value. But
then the quoting of a function call wasn't properly handled.

Rather than coping with the quoting rules here, have the catalog query
return a pgloader specific placeholder "GENERATE_UUID". Then the MS SQL
specific code can normalize that to the symbol :generate_uuid. Then the
generic PostgreSQL DDL code can implement the proper replacement for that
symbol, not having to know where it comes from.

Fix #742.
2018-02-17 00:25:33 +01:00
Dimitri Fontaine
0a315214f3 Some improvements on the GitHub issue template.
Well, let's be more direct to the user.
2018-02-17 00:18:42 +01:00
Dimitri Fontaine
a4a9fdf668 Add a GitHub issue template. 2018-02-17 00:12:36 +01:00
Dimitri Fontaine
5e3acbb462 When merging catalogs, "float" and "double precision" the same type.
PostgreSQL understands both spellings of the data type name and implements
float as being a double precision value, so we should refrain from any
warning about that non-discrepency when doing a data-only load.

Should fix #746.
2018-02-16 23:42:46 +01:00
Dimitri Fontaine
67a1b1d408 Fix SQLite SQL queries.
Some copy-paste errors made their way to those queries and prevented usage
of pgloader, but I missed that because I was using a previous version of the
query text files in my interactive environment.

Also, SQLite doesn't like the queries finishing with a semi-colon, so remove
them.

Fixes #747.
2018-02-16 17:51:58 +01:00
Christoph Berg
8e3ebd5f1e Remove obsolete "make docs" target
pgloader.1.md doesn't exist anymore
2018-02-13 21:02:59 +01:00
Xavier Noria
d0fbd2bf5c Typo fix in the README (MacOSX, macOs)
updates the name of Mac OS X (#743)
2018-02-13 11:28:26 +01:00
Dimitri Fontaine
ea6c91b429 Fix "drop default" casting rules for all databases.
The support for drop default in (user defined) casting rules was completely
broken in SQLite, because the code didn't even bother looking at what's
returning after applying the casting rules.

This patch fixes the code so that is uses the pgcol instance's default
value, as per after applying casting rules. The bug also existed in a subtle
form for MySQL and MS SQL, but would only show up there when the default
value is spelled using a known variation of “current timestamp”.
2018-02-08 23:33:51 +01:00
Dimitri Fontaine
29506e6fa6 Assorted fixes for SQLite.
First review the `sqlite_sequence` support so that we can still work with
databases that don't have this catalog, which doesn't always exists -- it
might depend on the SQLite version though.

Then while at it use the sql macro to host the SQLite “queries” in their own
files, enhancing the hackability of the system to some degrees. Not that
much, because we have to use a lot of PGRAMA command and then the column
output isn't documented with the query text itself.
2018-02-08 22:55:15 +01:00
Dimitri Fontaine
20d7858e27 Implement SQLite casting rule for “decimal”.
Fix #739.
2018-02-07 20:47:47 +01:00
Dimitri Fontaine
976e4c1c1d Fix SQLite processing of columns with a sequence attached.
The handling of the SQLite catalogs where fixed in a previous patch, but
either it's been broken in between or it never actually worked (oops).

Moreover, the recent patch about :on-update-current-timestamp changed the
casting rules matching code and we should position :auto-increment from the
SQLite module rather than "auto_increment" as before. That's better, but
wasn't done.

Fix #563 again, tested with a provided test-case (thanks!).
2018-01-31 22:49:10 +01:00
Dimitri Fontaine
4612e68435 Implement support for new casting rules guards and actions.
Namely the actions are “keep extra” and “drop extra” and the casting rule
guard is “with extra on update current timestamp”. Having support for those
elements in the casting rules allow such a definition as the following:

      type timestamp with extra on update current timestamp
        to "timestamp with time zone" drop extra

The effect of such as cast rule would be to ignore the MySQL extra
definition and then refrain pgloader from creating the PostgreSQL triggers
that implement the same behavior.

Fix #735.
2018-01-31 15:17:05 +01:00
Dimitri Fontaine
5ecd03ceba Don't push-row a nil value.
In case of a failure to pre-process or transform values in the row that as
been read, we need to refrain from pushing the row into our next batch.

See #726, that got hit by the recent bug in the middle of something else
entirely.
2018-01-25 23:53:11 +01:00
Dimitri Fontaine
25152f6054 Add a restart-case for interactive debugging.
When dealing with MATERIALIZING VIEWS test cases and failing in the middle
of them, as it happens when fixing bugs, then it was tedious (to say the
least) to clean-up manually the view each time.

That said, for end-users, doing it automatically would risk cleaning-up the
wrong view definition if they had a typo in their pgloader command, say.

Common Lisp helps a lot here: we simply create a restart that is only
available interactively for the developers of pgloader!
2018-01-25 23:38:59 +01:00
Dimitri Fontaine
7b08b6e3d3 Refrain from creating tables in “data only” operations.
We forgot that rule in the case of creating the target tables for the
materializing views commands, which led to surprising and wrong behavior.

Fix #721, and add a new test case while at it.
2018-01-25 23:32:31 +01:00
Dimitri Fontaine
5ba42edb0c Review misleading error message with schema not found.
It might be that the schema exists but we didn't find what we expected to
in there, so that it didn't make it to pgloader's internal catalogs. Be
friendly to the user with a better error message.

Fix #713.
2018-01-25 23:29:36 +01:00
Dimitri Fontaine
a603cd8882 Step back on (safety 0) optimization.
It doesn't appear worth it at this time yet, too risky.
2018-01-24 23:26:37 +01:00
Dimitri Fontaine
6ae3bd1862 Docs cleanup.
Don't maintain generated files in git, it's useless (thanks mainly to
readthedocs), also remove the previous format of the docs.
2018-01-24 22:47:37 +01:00
Dimitri Fontaine
f86371970f Review the pgloader COPY implementation further.
Refactor file organisation further to allow for adding a “direct stream”
option when the on-error-stop behavior has been selected. This happens
currently by default for databases sources.

Introduce the new WITH option “on error resume next” which forces the
classic behavior of pgloader. The option “on error stop” already existed,
its implementation is new.

When this new behavior is activated, the data is sent to PostgreSQL
directly, without intermediate batches being built. It means that the whole
operation fails at the first error, and we don't have any information in
memory to try replaying any COPY of the data. It's gone.

This behavior should be fine for database migrations as you don't usually
want to fix the data manually in intermediate files, you want to fix the
problem at the source database and do the whole dance all-over again, up
until your casting rules are perfect.

This patch might also incurr some performance benenits in terms of both
timing and memory usage, though the local testing didn't show much of
anything for the moment.
2018-01-24 22:45:23 +01:00
Dimitri Fontaine
8ee799070a Simplify format-vector-row a lot.
Copy some code over from cl-postgres-trivial-utf-8 and add the support for
PostgreSQL COPY escaping right at the same place, allowing to allocate our
formatted utf-8 buffer only once, with the escaping already installed.

This patch was expected to be more about perfs, but it's actually only about
code cleaning it seems, as it doesn't make a big difference in the testing I
could do here.

That said, getting rid of one intermediate buffer should be nice in terms of
memory management.
2018-01-24 00:10:40 +01:00
Dimitri Fontaine
adf03c47ad Clean up source code organisation.
The copy format and batch facilities are no longer the meat of your
PostgreSQL support in the src/pgsql directory, so have them leave in their
own space.
2018-01-23 19:52:13 +01:00
Dimitri Fontaine
3bb128c5db Review format-vector-row.
This function prepares the data to be sent down to PostgreSQL as a clean
COPY text with unicode handled correctly. This commit is mainly a clean-up
of the function, and also adds some smarts to try and make it faster.

In testing, the function is now tangentially faster than before, but not by
much. The hope here is that it's now easier to optimize it.
2018-01-22 21:37:14 +01:00
Dimitri Fontaine
ba2d8669c3 Add support for the newer Qmynd error handling.
We now have a qmynd-impl::decoding-error condition to deal with, which as a
very good error reporting, so that we don't need to poke into babel details
anymore. The error message adds the column name, type and collation to the
output, too.

We keep the babel handlers for a while until people have all migrated to
using the patch in qmynd.

With the fix to Qmynd, Fix #716.
2018-01-22 16:14:05 +01:00
Dimitri Fontaine
572f6a3dbe Fix CSV separator parsing.
The previous patch introduced parser conflicts and we couldn't parse some
expressions any more, such as the following:

        fields escaped by '\',

It's now possible to represent single quote as either '''', '\'', or '0x27'
and we still can parse '\' as being a single backslash character.

See #705.
2018-01-14 15:33:47 +01:00
Julien Danjou
bb6c3d0a32 doc: fix a few link format (#711)
They are still in Markdown format, remove or move to rst.
2018-01-09 19:22:21 +01:00
Olivier Macchioni
b683292784 Fix broken link to https://pgloader.io/ (#706) 2017-12-28 18:59:50 +01:00
Dimitri Fontaine
81be9ae60e Implement support for \' as the CSV separator.
The option "fields optionally enclosed by" was missing a way to easily
specify a single quote as the quoting character. Add '\'' to the existing
solution '0x27' which isn't as friendly.

See #705.
2017-12-26 21:04:06 +01:00
Dimitri Fontaine
07cdf3e7e5 Use MySQL column names in MySQL queries.
The query for concurrency-support didn't get the memo that we should ignore
PostgreSQL identifier-case when querying the source MySQL database. Fix the
query string to include column names as given by the MySQL catalogs.

In bug report #703, the problem is found in PostgreSQL queries. This has
been fixed before already. Trying to reproduce the bug produced an error in
the concurrency-support query instead, so let's fix this one.

Fix #703.
2017-12-22 14:15:46 +01:00
Dimitri Fontaine
25c79dfebc Switch the documentation to using Sphinx.
The website is moving to pgloader.org and readthedocs.io is going to be
integrated. Let's see what happens. The docs build fine locally with the
sphinx tools and the docs/Makefile.

Having separate files for the documentation should help ease the maintenance
and add new topics, such as support for Common Lisp Hackers level docs,
which are currently missing.
2017-12-21 17:45:09 +01:00
Dimitri Fontaine
21f8baabab Update CNAME 2017-12-21 17:21:19 +01:00
Dimitri Fontaine
62b45e4d16 Fix log type output for summary files.
A summary file could be asked for which is not of either csv, json or copy
format. Then use the text format.

Fix #695.
2017-12-06 20:57:19 +01:00
Dimitri Fontaine
b7d87a9eb1 Fix MySQL bit(1) casting function.
When this function was written, pgloader would get an array of numbers over
the wire, nowadays it looks like it's receiving an array of characters
instead (in other words, a string).

Improve the `bits-to-boolean` function to accept either input, and raise an
error in another case.

My theory is that something changed either in MySQL (with version 10) or in
the Qmynd driver somehow... but tonight we just go easy and fix the bug
locally rather than try and understand where it might be coming from.

Fixes #684.
2017-12-03 23:06:54 +01:00
Dimitri Fontaine
c05183fcba Implement support for Foreign Tables and Partitionned Tables.
Due to the way pgloader queries the PostgreSQL catalogs, it restricted the
target table to be “ordinary” tables, as per the relkind description in the
https://www.postgresql.org/docs/current/static/catalog-pg-class.html
PostgreSQL documentation.

Extend this to support relkind of 'r', 'f' and 'p'.

Fixes #587, fixes #690.
2017-12-01 22:13:47 +01:00
Dimitri Fontaine
52f13456d9 Rewrite the SQLite type name parsing.
SQLite being very very liberal in type names (I think it accepts anything
and everything actually), our simple approach of tokenizing the input and
discarding noise words is not enough.

In this patch, we implement a new light parser for the SQLite type names to
better cope with noise words and random spacing of the catalog values that
SQLite failed to normalize. Well it didn't attempt, apparently.

Fix #548.
2017-11-28 18:19:12 +01:00
Dimitri Fontaine
2b861a3e96 New SQLite test cases. 2017-11-25 16:31:42 -08:00
Dimitri Fontaine
87f35e8852 Refrain from loading incomplete foreign key references in SQLite.
Given INCLUDING and EXCLUDING support it might be possible that we migrate a
table from SQLite without having selecting tables pointed to by foreign
keys. In that case, pgloader should still be able to load the data
definition and content fine, just skipping the incomplete fkey definitions.

That's implemented in this patch, which has been tested thanks to a
reproducible data set being made available!

Fixes #681.
2017-11-25 16:31:41 -08:00
Olleg Samoylov
62d776f5e8 Uppercase the SQL queries for MS SQL
In cases when the MS SQL database is setup with a case sensitive collation, then it would not find the catalog objects referenced from the query. To fix, just use UPPERCASE names, as they do work in both case insensitive and case sensitive collations.

In passing, add `system-index.txt` to `.gitignore` (generated by make).

Fixes #651.
2017-11-25 02:23:25 +01:00
Dimitri Fontaine
d69b72053a Implement default unsigned casting rules for MySQL.
The following casting rules are now the default for MySQL:

  - type tinyint when unsigned to smallint   drop typemod
  - type smallint when unsigned to integer  drop typemod
  - type mediumint when unsigned to integer  drop typemod
  - type integer when unsigned to bigint    drop typemod

Fixes #678.
2017-11-22 10:29:11 -08:00
Dimitri Fontaine
5c60f8c35c Implement a new type casting guard: unsigned.
MySQL allows using unsigned data types and pgloader should then target a
signed type of a larger capacity so that values can fit. For example, the
data definition “smallint(5) unsigned” should be casted to “integer”.

This patch allows user defined cast rules to be written against “unsigned”
data types as per their MySQL catalog representation.

See #678.
2017-11-22 10:26:03 -08:00
Dimitri Fontaine
6964764fb4 Find schema names unquoted.
When doing a MySQL to PostgreSQL migration in data only mode, pgloader
matches schema names found on both source and target database, and much like
with table names must do so ensuring unquoted schema names.

Otherwise we fail to find the schema name again, because one spelling has
the quotes, but not the other one, when using the “quote identifiers”
option.

Fix #659, at least some forms of it.
2017-11-19 17:12:21 +01:00
Dimitri Fontaine
1d7706c045 Fix the MySQL encoding error handling.
The error handling would try and read past the error buffer in some cases,
when the BABEL lib would give a position that's after the buffer read.

Fix #661.
2017-11-13 11:27:47 +01:00
Christoph Berg
5c4a64197d Run regression tests via autopkgtest 2017-11-12 21:05:48 +01:00
Christoph Berg
78df9c314a Sync Depends to cl-pgloader.
* Sync Depends to cl-pgloader.
* Priority: optional, move cl-pgloader to Section: lisp.
* Update S-V.
2017-11-11 17:14:18 +01:00
Christoph Berg
3002f4d30e Add new B-D cl-mustache and cl-yason. 2017-11-11 16:47:08 +01:00
Christoph Berg
28ea825d85 Run wrap-and-sort -st. 2017-11-11 16:39:19 +01:00
Dimitri Fontaine
db7a91d6c4 Add the MySQL target schema to the search_path.
In the next release, pgloader defaults to targetting a new schema named the
same as the MySQL database, because that's what makes more sense. But people
are used to having 'public' in the search_path and everything in there.

So when creating our target schema, when migrating from MySQL, arrange it so
that the new schema is in the search_path by issuing a command like:

  ALTER DATABASE plop SET search_path TO public, f1db;

And make this command visible in verbose (NOTICE) mode too, so that user can
see what happens.

Fix #654. I think.
2017-11-02 12:40:21 +01:00
Dimitri Fontaine
6b6c1c7d34 Add log entries for connection strings.
It helps a lot to debug what's happening, and it seems that we lost the
information when cleaning up the log levels in recent efforts to unclutter
the default output.
2017-11-02 12:38:45 +01:00
Dimitri Fontaine
501762d2f5 Update the website with the new Gumroad id. 2017-11-01 16:38:54 +01:00
Dimitri Fontaine
dd401c57f3 Fix a latent bug discovered in local testing with CCL.
It turns out that when using *print-pretty* in CCL we then have CL reader
references in the output, such as in the following example:

  QUERY: comment on table mysql.base64 is $#1=DXIDC_EMLAQ$Test decoding base64 documents$#1#$

Of course that's wrong, so prevent this from happening by
forcing *print-pretty* to nil in a top-level function. We still turn this on
in the monitor thread when printing error messages as those might contain
recursive data structures.
2017-10-21 21:06:35 +02:00
Dimitri Fontaine
0a88645eb5 Fix time measurements of the write activity.
When using --verbose or more detailed log messages, the summary prints
timings for both read and write operations separately. The write summary
timing took into account only the PostgreSQL batch activity, discarding the
formatting of the data done by pgloader.

As this formatting is quite heavy at the moment, the results are pretty
misleading without that information.
2017-10-21 21:04:55 +02:00
Dimitri Fontaine
a9afddf8ed Accept quoted namestrings as target type names for cast rules.
This allows passing "double precision" rather than float8, for example.

Fix #650.
2017-10-21 21:03:58 +02:00
Dimitri Fontaine
a28e9b3556 Prevent evaluating unused arguments in log-message.
A stop-gap has been installed to prevent sending too much trafic to the
monitor, but the log-message arguments were still evaluated, and the :data
level output from format-row-in-batch is pretty costly.
2017-10-16 17:26:07 +02:00
Dimitri Fontaine
b36f36b74e Add a (local) test case. 2017-10-16 17:25:44 +02:00
Dimitri Fontaine
9b80d2914c List files to load for system.
Install a new function in the hooks file. This function might help fix
--self-upgrade later, we keep it around for when we'll have time to see
about that.
2017-10-16 17:24:47 +02:00
Dimitri Fontaine
52720a5e6f Prefer QL overrides to ASDF setup.
The ql:*local-project-directories* is a much better facility for us to load
pgloader from the local PWD rather than from the QL distribution. It looks
like the previous method worked by accident, for once, and also downloaded
pgloader from QL, unnecessarily (we have the sources locally).
2017-10-03 13:47:48 +02:00
Dimitri Fontaine
5b227200a9 Fix error handling at monitor thread startup.
Errors such as failing to open the log file (maybe because of bad
permissions) weren't correctly handled. This fixes the problem by handling
the conditions at the lparallel task handler level and signaling a brand new
condition up to the main outside handler.

Fixes #638.
2017-10-03 01:23:59 +02:00
Dimitri Fontaine
2595ddaae3 Fix total-line in reporting.
We did it correctly for the bytes, and we need to apply the same logic to
other metric: the relevant information in the total summary line is the sum
from the data parts, not the sum from the postload parts.
2017-09-19 12:28:24 +02:00
Dimitri Fontaine
460fe6cc77 Fix quoting of default values for MariaDB 10 support.
The default values quoting changed in MariaDB 10, and we need to adjust in
pgloader: extra '' chars could defeat the default matching logic:

  "'0000-00-00'" is different from "0000-00-00"
2017-09-19 11:29:53 +02:00
Dan
62991bd5c5 Add missing column to GROUP BY. (#633) 2017-09-16 21:15:11 +02:00
Dimitri Fontaine
8a361a0ff8 Add support for multiple on update columns per table.
The MySQL special syntax "on update current_timestamp()" used to support
only a single column per table (in MySQL), and so did pgloader. In MariaDB
version 10 it's now possible to have several column with that special
treatment, so adapt pgloader to migrate that too.

What pgloader does is recognize that several columns are to receive the same
pre-update processing, and creates a single function that does the both of
them, as in the following example, from pgloader logs in a test case:

    CREATE OR REPLACE FUNCTION mysql.on_update_current_timestamp_onupdate()
      RETURNS trigger
      LANGUAGE plpgsql
      AS
    $$
    BEGIN
       NEW.update_date = now();
       NEW.calc_date = now();
       RETURN NEW;
    END;
    $$;
    CREATE TRIGGER on_update_current_timestamp
            BEFORE UPDATE ON mysql.onupdate
          FOR EACH ROW
      EXECUTE PROCEDURE mysql.on_update_current_timestamp_onupdate();

Fixes #629.
2017-09-15 01:04:57 +02:00
Dimitri Fontaine
b7347a567c Add test cases for MySQL.
At the moment it's a very manual process, and it might get automated
someday. Meanwhile it's still useful to have.

See #569 for an issue that got a test case added.
2017-09-14 15:59:10 +02:00
Dimitri Fontaine
a498313074 Implement support for MySQL FULLTEXT indexes.
PostgreSQL btree indexes are limited in the size of the values they can
index: values must fit in an index page (8kB). So when porting a MySQL full
text index over full documents, we might get into an error like the
following:

  index row size 2872 exceeds maximum 2712 for index "idx_5199509_search"

To fix, query MySQL for the index type which is FULLTEXT rather than BTREE
in those cases, and port it over to a PostgreSQL Full Text index with an
hard-coded 'simple' configuration, such as the following test case:

  CREATE INDEX idx_75421_search ON mysql.fcm_batches USING gin(to_tsvector('simple', raw_payload));

Of course users might want to use a better configuration, including proper
dictionnary for the documents. When using PostgreSQL each document may have
its own configuration attached and yet they can all get indexed into the
same index, so that's a task for the application developpers, not for
pgloader.

In passing, fix the list-typenames-without-btree-support.sql query to return
separate entries for each index type rather than an {array,representation}
of the result, as Postmodern won't turn the PostgreSQL array into a Common
Lisp array by default. I'm kept wondering how it worked before.

Fix #569.
2017-09-14 15:40:34 +02:00
Dimitri Fontaine
987c0703ad Some default values come properly quoted from MariaDB now.
Adjust the default value formating to check if the default value is already
single-quoted and only add new 'single quotes' when it's not the case.

Apparently ENUM default values in MariaDB 10 are now properly single quoted.
2017-09-14 15:39:04 +02:00
Dimitri Fontaine
dfac729daa Refrain from querying the catalogs again.
When we already have the information in the pgloader internal catalogs,
don't issue another MySQL query. In this case, it's been used to fetch the
list of columns and their data types so that we can choose to send either
`colname` or maybe astext(`colname`) as `colname` for some geographic types.

That's one less MySQL query per table.
2017-09-14 15:35:45 +02:00
Dimitri Fontaine
181f344159 Add support for current_timestamp() default spelling.
That's new in MariaDB 10 apparently.
2017-09-14 15:33:18 +02:00
Dimitri Fontaine
f921658866 Remove useless noise in the logs.
The individual CAST decisions are visible in the CREATE TABLE statements
that are logged a moment later. Also, calling `format-create-sql' on a
column definition that's not finished to be casted will process default
values before they get normalized, and issue WARNING to the poor user.

Not helpful. Bye.
2017-09-14 15:30:29 +02:00
Dimitri Fontaine
dbadab9e9e Implement a new “snake_case” quoting rule.
In passing, add the identifiers case option to SQLite support, which makes
it easier to test here, and add a table named "TableName" to our local test
database.

Fix #631.
2017-09-13 22:55:10 +02:00
Dimitri Fontaine
d2d4be2ed0 Fix test/csv-guess.load for old PostgreSQL.
In travis environment we still test with PostgreSQL 9.1 and 9.6, and there's
no reason for this test to use a modern spelling of create schema, after
all.

It works because the test/csv-before-after.load creates the schema and is
ran before test/csv-guess.load. That's good enough for now.
2017-09-09 00:59:39 +02:00
Dimitri Fontaine
38712d98e0 Fix regression testing.
Previous patch made regression failures obvious that were hidden by strange
bugs with CCL.

One such regression was introduced in commit
ab7e77c2d00decce64ab739d0eb3d2ca5bdb6a7e where we played with the complex
code generation for field projection, where the following two cases weren't
cleanly processed anymore:

  column text using "constant"
  column text using "field-name"

In the first case we want to load a user-defined constant in the column, in
the second case we want to load the value of the field "field-name" in the
column --- we just have different source and target names.

Another regression was introduced in the recent commit
01e5c2376390749c2b7041b17b9a974ee8efb6b2 where the create-table function was
called too early, before we have fetched *pgsql-reserved-keywords*. As a
consequence table names weren't always properly quoted as shown in the
test/csv-header.load file which targets a table named "group".

Finally, skip the test/dbf.load regression test when using CCL as this
environment doesn't have the necessary CP850 code page / encoding.
2017-09-09 00:51:07 +02:00
Dimitri Fontaine
ebf9f7a6a9 Review and cleanup the logging monitor thread.
Due to errors in regression testing when using CCL, review this part of
pgloader. It turns out that cl-log:stop-messenger on a text-stream-messenger
closes the stream, which isn't a good idea when given *standard-output*.

At least it makes CCL chokes when it then wants to output something of its
own, such as when running in --batch mode (which is nice because it outputs
more diagnostic information).

To solve that problem, initialize the text-stream-messenger with a broadcast
stream made from *standard-output*, which we now may close at will.
2017-09-08 23:03:41 +02:00
Dimitri Fontaine
e7f6505d7d Review compile time dependencies.
The parser files don't depend on the sources, it's the other way round
nowadays. Also, the responsability to decipher the *sections* context should
be restricted to the monitor.lisp file, which is now the case.

And this time, fix #628 for real.
2017-09-08 15:38:32 +02:00
Dimitri Fontaine
9be130cdbe Fix symbol export hacks to execute at load time.
It seems that when compiling with CCL in “batch” mode, that is using
buildapp, the local symbol exporting facility didn't work at all. It needs
to be run at load time so that the compiler sees the symbols.

Fix #628.
2017-09-08 12:33:24 +02:00
Dimitri Fontaine
a9e8bfd4d7 Support for colon characters in PostgreSQL socket path.
Google Cloud SQL instances are now using the following format for the name
of their socket <PROJECT-ID>:<REGION>:<INSTANCE_NAME>. We do that by
allowing to escape a colon in the socket directory name by doubling it, as
in the username field. It also allows to accept any character in the socket
directory name, which is a good cleanup.

Fix #621.
2017-08-30 15:22:42 +02:00
Dimitri Fontaine
d5072d11e5 Implement support for a pgpass file.
The implementation follows PostgreSQL specifications as closely as possible,
with the escaping rules and the matching rules. The default path where to
find the .pgpass (or pgpass.conf on windows) are as documented in PostgreSQL
too. Only missing are the file permissions check.

Fix #460.
2017-08-29 03:16:35 +02:00
Dimitri Fontaine
bcc934d7aa Cleanup.
Some code was pasted twice in src/api.lisp, and a defstruct with no slots
isn't spelled the way I did in previous patches. We use a defstruct with no
slots for defining a hierarchy on which to dispatch our pretty-print
function.
2017-08-26 20:31:24 +02:00
Dimitri Fontaine
33ab9bcdd5 Typo Fix. oops. 2017-08-25 22:21:34 +02:00
Dimitri Fontaine
01e5c23763 Add support for explicit TARGET TABLE clause in load commands.
It used to be that you would give the target table name as an option to the
PostgreSQL connection string, which is untasteful:

   load ... into pgsql://user@host/dbname?tablename=foo.bar ...

Or even, for backwards compatibility:

   load ... into pgsql://user@host/dbname?foo.bar ...

The new syntax makes provision for a separate clause for the target table
name, possibly schema-qualified:

   load ... into pgsql://user@host/dbname target table foo.bar ...

Which is much better, in particular when used together with the target
columns clause.

Implementing this seemingly quite small feature had impact on many parsing
related features of pgloader, such as the regression testing facility. So
much so that some extra refactoring got into its way here, around the
lisp-code-for-loading-from-<source> functions and their usage in
`load-data'.

While at it, this patch simplifies a lot the `load-data' function by making
a good use of &allow-other-keys and :allow-other-keys t.

Finally, this patch splits main.lisp into main.lisp and api.lisp, with the
latter intended to contain functions for Common Lisp programs wanting to use
pgloader as a library. The API itself is still the same as before this
patch, tho. Just in another file for clarity.
2017-08-25 01:57:54 +02:00
Dimitri Fontaine
72c58306ba Fix the previous fix.
See #614. Again. Should be ok now.
2017-08-25 01:56:34 +02:00
Dimitri Fontaine
f20a5a0667 Fix schema name comparing with quoted schema names.
In the previous commit we introduced support for database names including
spaces, which means that by default pgloader creates a target schema in
PostgreSQL with a space in its name. That works well as soon as you always
double-quote the schema name, which pgloader does.

Now, in our internal catalogs, we keep the schema name double-quoted. And
when comparing that schema names with quotes to the raw schema name from
PostgreSQL, they won't match, and pgloader tries to create the schema again:

  ERROR Database error 42P06: schema "my sql" already exists

Fix the comparing to compare unquoted schema name, fix #614 again: the
previous fix would only work the first time.
2017-08-25 01:47:49 +02:00
Dimitri Fontaine
9d4743f598 Allow database names to contain spaces.
Then they must be quoted (single or double quotes accepted), of course.

Fix #614.
2017-08-24 23:05:26 +02:00
Dimitri Fontaine
9263baeb49 Implement sslmode for MySQL connections.
This allows to bypass SSL when you don't need it, like over localhost for
instance. Takes the same syntax as the PostgreSQL sslmode connection string
parameter.
2017-08-24 14:56:59 +02:00
Dimitri Fontaine
b685c8801d Improve guessing of CSV parameters.
In this commit we fail the guess faster, allowing to test for a much larger
sample. The sample is still hard-coded, but this time to 1000 lines.

Also add a test case, see #618.
2017-08-24 13:30:14 +02:00
Dimitri Fontaine
8004a9dd59 Improve report output with bytes information.
Understanding the timings requires not only the number of rows copied into
each table but also how many bytes that represent. We add that information
now in tht output.

The number of bytes presented is computed from the unicode representation we
prepare in pgloader for each row before sending it down to PostgreSQL.
2017-08-24 12:45:51 +02:00
Dimitri Fontaine
3b93ffa37a Rewrite the reporting support entirely.
Use a generic function protocol in order to implement the human readable,
verbose, csv, copy and json reporting output formats. This is much cleaner
and extensible than the previous way.

Use that new power to implement a real JSON output from the internal state
object.
2017-08-24 12:33:51 +02:00
Dimitri Fontaine
4fcb24f448 Reintroduce manual Garbage Collect in SBCL.
It seems that SBCL still needs some help in deciding when to GC with very
large values. In a test case with a “data” column averaging 375kB (up to
about 3 MB per datum), it allows much larger batch size and prefetch rows
settings without entering lldb.
2017-08-23 16:27:14 +02:00
Dimitri Fontaine
4f9eb8c06b Track bytes sent to PostgreSQL.
The pgstate infrastructure already had lots of details about what's going
on, add to it the information about how many bytes are sent in every batch,
and use this information in the monitor when something long is happening to
display how many rows we sent from the beginning for this (supposedly) huge
table, along with bytes and speed (bytes per seconds).
2017-08-23 11:55:49 +02:00
Dimitri Fontaine
1f242cd29e Fix comment support to schema qualify target tables. 2017-08-23 11:26:08 +02:00
Dimitri Fontaine
a849f893a6 Implement a base46-decode transformation function. 2017-08-21 17:06:06 +02:00
Dimitri Fontaine
c62f4279c0 Be more verbose with long-running loads.
Add a message every 20 batches so that the user knows it's still going on.
Also, in passing, fix some messages: present is not precise enough to decide
if the log refers to an event that is being done or starting next.
2017-08-21 16:50:16 +02:00
Dimitri Fontaine
28db6b9f13 Desultory cleanup of a useless declaim. 2017-08-21 16:46:32 +02:00
Dimitri Fontaine
03a8d57a50 Review --verbose log message.
The verbosity is not that easy to adjust. Remove useless messages and add a
new one telling when the COPY of a table is done. As we might have to wait
for some time for indexes being built. keep the CREATE INDEX lines. Also
keep the ALTER TABLE both for primary keys and foreign keys, again because
the user might have to wait for quite some time.
2017-08-21 15:27:13 +02:00
Dimitri Fontaine
f719d2976d Implement a template system for pgloader commands.
This feature has been asked several times, and I can't see any way to fix
the GETENV parsing mess that we have. In this patch the GETENV support is
retired and replaced with a templating system, using the Mustache syntax.

To get back the GETENV feature, our implementation of the Mustache template
system adds support for fetching the template variable values from the OS
environment.

Fixes #555, Fixes #609.
See #500, #477, #278.
2017-08-16 01:33:11 +02:00
Dimitri Fontaine
e21ce09ad7 Implement support for MySQL linestring data type.
This data type is now converted automatically to a PostgreSQL path data
type, using the open path notation with square brackets:

  https://www.postgresql.org/docs/current/static/datatype-geometric.html#AEN7103

Fix #445.
2017-08-15 15:26:06 +02:00
Dimitri Fontaine
20a85055f4 Implement support for MS SQL set parameters.
It is sometimes needed to tweak MS SQL server parameters, such as the
textsize parameters which allows fetching the whole set of bytes of a text
of binary column (not kidding).

Now it's possible to add such a line in the load file:

  set mssql parameters textsize to '104857600'

Fixes #603.
2017-08-12 23:43:22 +02:00
Dimitri Fontaine
30f359735c Make it easier to test “main” code.
This code path is exercised from the command line only, which means I don't
get to run it that often. And it's a pain to debug. So make it easier to run
`process-source-and-target` from the REPL.
2017-08-10 21:58:53 +02:00
Dimitri Fontaine
773dcaeca3 Fix a race condition in the monitor thread.
Startup log messages could be lost because the monitor would be started but
not ready to process messages. Fix that by “warming up” the monitoring
thread, having it execute a small computation and more importantly wait for
the result to be received back, blocking.

See #599 where parsing errors from a wrong URL were missed in the command
line output, quite disturbingly.
2017-08-10 21:51:55 +02:00
Dimitri Fontaine
370038a74e Fix the PostgreSQL URL in the MySQL howto.
See #599 again, wherein I missed that the URL error was not a copy-paste'o
but rather an error in the documentation itself…
2017-08-10 21:49:51 +02:00
Dimitri Fontaine
952e7da191 Bug fix CREATE TYPE in schema (previous patch).
The previous patch fixed CREATE TYPE so that ENUM types are created in the
same schema than the table using them, but failed to update the DROP TYPE
statements to also target this schema...
2017-08-10 21:19:25 +02:00
Dimitri Fontaine
073a5c1e37 Fix Ergast link in MySQL howto.
See #599.
2017-08-10 20:58:24 +02:00
Dimitri Fontaine
5a65da2147 Create new types in the proper schema.
Previously to this patch, pgloader wouldn't care about which schema it
creates extra types in. Extra types are mainly ENUM and SET support from
MySQL. Now, pgloader creates those extra PostgreSQL ENUM types in the same
schema as the table using them, which is a more sound default.
2017-08-10 18:57:09 +02:00
Dimitri Fontaine
981b801ce7 Fix user defined rules to cast ENUM to Text.
The MySQL enum are casted to PostgreSQL enum types just fine, but sometimes
that's not what the user wants. In case when we have a CAST rule for an ENUM
column, recognize the fact and respect user choice.

Fixes #608.
2017-08-10 18:01:17 +02:00
Dimitri Fontaine
049a1199c2 Implement support for SQLite current_date default value.
The spelling in SQLite for the default value is "current_date", instruct
pgloader about that. This commit also adds a test case in our sqlite.db
unit tests database.

Fixes #607.
2017-08-08 21:55:15 +02:00
Luke Snape
ecd6a8e25c Ignore nulls in varbinary-to-string transform (#606) 2017-08-07 21:37:37 +02:00
Dimitri Fontaine
38a6b4968d Improve bundle building.
Now when building a bundle file for source distribution of pgloader, always
test it by building a binary image from the bundle tarball in a test
directory. Also make it easy to target "latest" Quicklisp distribution with
the following spelling:

    make BUNDLEDIST=latest bundle
2017-08-01 19:20:15 +02:00
Dimitri Fontaine
72431d4708 Improve the Quicklist dist support for bundles.
When distributing a pgloader bundle we're using the ql-dist facility. In
recent commit we hand-picked the last known working distribution of
quicklisp for pgloader. Make it easy to target "latest" known distribution
or hard-code one from the Makefile or the bundle/ql.lisp file.
2017-08-01 18:48:20 +02:00
Dimitri Fontaine
5c1c4bf3ff Fix MySQL Enum parsing.
We use a CSV parser for the MySQL enum values, but the quote escaping wasn't
properly setup: MySQL quotes ENUM values with a single-quote (') and uses
two of them ('') for escaping single-quotes when found in the ENUM value
itself.

Fixes #597.
2017-08-01 18:40:27 +02:00
Dimitri Fontaine
3103b0dc72 Escape SQL identifiers in SQLite catalog queries.
SQLite supports the backtick escaping for SQL identifiers and we'd rather
use it. Fixes #600.
2017-07-31 23:11:29 +02:00
Dimitri Fontaine
d37ad27754 Handle empty tables in concurrency support for MySQL.
When the table is empty we get nil for min and max values of the id column.
In that case we don't compute a set of ranges and “cancel” concurrency
support for the empty table.

Fixes #596.
2017-07-18 13:35:01 +02:00
Dimitri Fontaine
b1fa3aec3c Implement a separate switch to drop the schemas.
The with option “include drop” used to also apply to schemas, which is not
that useful and problematic when trying to DROP SCHEMA public, because you
might not connect as the owner of that schema.

Even if we don't target the public schema by default, users can choose to do
so thanks to our ALTER SCHEMA ... RENAME TO ... command.

Fixes #594.
2017-07-18 13:13:36 +02:00
Dimitri Fontaine
ae0c6ed119 Add support for preserving index names in SQLite.
See #187.
2017-07-17 11:04:12 +02:00
Dimitri Fontaine
cf6182fafa Add a notice message with guessed parameters.
We might have to help users debug our decision, and I expect we will have to
improve our guess “engine” here.
2017-07-07 02:34:23 +02:00
Dimitri Fontaine
471f2b6d88 Implement automagic guessing of CSV parameters.
As we know how many columns we expect from the input file, it's possible to
read a sample (10 lines as of this patch) and try many different CSV reader
parameters combinations until we find one that works: it returns the right
number of fields.

It is still possible of course to specify parameters on the command line or
in a load file if necessary, but it makes the simple case even simpler. As
simple as:

  pgloader file.csv pgsql:///pgloader?tablename=target
2017-07-07 02:16:53 +02:00
Dimitri Fontaine
14e1830b77 Fix CLI insistance of --field.
From a load file, as soon as pgloader can retrieve the schema of the target
table the source field list defaults to the target column list. Let's apply
the same rules to the command line.
2017-07-07 01:00:55 +02:00
Dimitri Fontaine
154c74f85e Update online docs with new release.
The docs/ directory goes to http://pgloader.io.
2017-07-06 17:07:55 +02:00
Dimitri Fontaine
64959595fc Back to development release in the master's branch. 2017-07-06 16:55:56 +02:00
Dimitri Fontaine
d71da6ba66 Release pgloader 3.4.1 2017-07-06 16:53:29 +02:00
Adrian Vondendriesch
058f9d5451 Debian (#578)
* debian: Bump compat version to 9.

* debian: Bump Standards-Version to 3.9.8
2017-07-06 15:38:14 +02:00
Dimitri Fontaine
7a371529be Implement "drop indexes" option for MySQL and MSSQL too.
It was only offered for SQLite without good reason really, and tests show
that it works as well with MySQL of course. Offer the option there too.

See 3eab88b1440a8166786e90b95f563d153e2ba4dc for details.
2017-07-06 10:06:03 +02:00
Dimitri Fontaine
2363d8845f Fix create schema handling in data only scenarios.
In b301aa93948f05b5189382f641cf1e040fc655f2 the "create schema" default
changed to true, which is a good idea. As a consequence pgloader should
consider this operation only when "create tables" is set: we don't want to
start with creating target schemas in a target database that is said to be
ready to host the data.
2017-07-06 09:48:03 +02:00
Dimitri Fontaine
dfe5c38185 Fix quoting policy in PostgreSQL ddl formating.
We already have apply-identifier-case and *identifier-case* to decide how
and when to quote our SQL object names, so don't force extra quotes in
format string: refrain from using ~s.
2017-07-06 09:47:48 +02:00
Dimitri Fontaine
9da012ca51 Fix identifiers quoting when reading PostgreSQL catalogs.
We sure can trust PostgreSQL to use names it knows how to handle. Still, it
will be happy to store in its catalogs names containing upper case, and in
that case we must quote them.
2017-07-06 03:16:06 +02:00
Dimitri Fontaine
e87477ed31 Restrict condition handling to relevant conditions.
In md-methods copy-database function, don't pretend we are able to handle
any condition when preparing the PostgreSQL schema, database-error is all we
are dealing with there really.
2017-07-06 03:16:05 +02:00
Dimitri Fontaine
d3d40cd47d Have git ignore local desktop files. 2017-07-06 03:16:05 +02:00
Dimitri Fontaine
e37cb3a9e7 Split SQL queries into their own files.
This change was long overdue. Ideally we would use something like the YeSQL
library for Clojure, but it seems like the cl-yesql equivalent is not ready
yet, and it depends on an experimental build system...

So this patch introduces an URL abstraction built on-top of a hash table.
You can then reference src/pgsql/sql/list-all-columns.sql as

  (sql "pgsql/list-all-columns.sql")

in the source code directly.

So for now the templating system is CL's format language. It is still an
improvement from embedded string. Again, one step at a time.
2017-07-06 03:16:05 +02:00
Dimitri Fontaine
d50ed64635 Defensive programming, after though.
It might be that a column-type-name is actually an sqltype instance, and
then #'string= won't be happy. Prevent that now with discarding any smarts
when the type name does not satisfies stringp.
2017-07-06 00:59:36 +02:00
Dimitri Fontaine
26d372bca3 Implement support for non-btree indexes (e.g. MySQL spatial keys).
When pgloader fetches the index list from a source database, it doesn't
fetch information about access methods for the indexes: I don't even know if
the overlap in between index access methods from one RDMBS to another covers
more than just btree...

It could happen that MySQL indexes a "geometry" column tho. This datatype is
converted automatically to "point" by pgloader, which is good. But the index
creation would fail with the following error message:

  Database error 42704: data type point has no default operator class for access method "btree"

In this patch when setting up the target schema we issue a PostgreSQL
catalog query to dynamically list those datatypes without btree support and
fetch their opclasses, with an hard-coded preference to GiST, then GIN, so
as to be able to automatically use the proper access method when btree isn't
available. And now pgloader transparently issues the proper statement:

  CREATE INDEX idx_168468_idx_location ON pagila.address USING gist(location);

Currently this exploration is limited to indexes with a single column. To
implement the general case we would need a more complex lookup: we would
have to find the intersection of all the supported access methods for all
involved columns.

Of course we might need to do that someday. One step at a time is plenty
good enough tho.
2017-07-06 00:42:43 +02:00
Dimitri Fontaine
8405c331a9 Error handling improvements for PostgreSQL schema.
In the complete PostgreSQL schema step, an error would be logged as you
expect but poorly handled: it would have the whole transaction rolled back,
meaning that a single Primary Key definition failure would cancel all the
others, plus the foreign keys, and also the triggers and comments.

It happens that other systems allow a primary column to contain NULL values,
which is forbidden in the standard and enforced by PostgreSQL, so that's not
a theoritical concern here.
2017-07-05 17:53:33 +02:00
Dimitri Fontaine
bae40d40c3 Fix identifier quoting corner cases.
In cases when pgloader needs to build a new identifer from existing
ones (mainly for renaming indexes, because they are unique per-table in the
source database and unique per-schema in PostgreSQL), and we compose the new
name from already quoted strings, pgloader was doing the wrong thing.

Fix that by having a build-identifier function that may unquote parts then
re-quote properly (if needed) the new identifier.
2017-07-05 15:37:21 +02:00
Dimitri Fontaine
f6cb428c6d Check empty strings in DB3 numeric fields.
Another blind attempt at fixing pgloader from a bug report on gitter, see
2017-07-04 23:15:47 +02:00
Dimitri Fontaine
652e435843 Only catch thread errors in pgloader-image.
In the REPL we're going to have all errors pop in the interactive debugger,
and that should be what we want...
2017-07-04 01:55:27 +02:00
Dimitri Fontaine
3f7853491f Refactor PostgreSQL error handling.
The code was too complex and the transaction / connection handling wasn't
good enough, too many reconnections when a ROLLBACK; is all we need to be
able to continue our processing.

Also fix some stats counters about errors handled, and improve error message
by adding PostgreSQL explicitely, and the name of the table where the error
comes from.
2017-07-04 01:41:08 +02:00
Dimitri Fontaine
3eab88b144 Add a new "drop indexes" option for databases.
This allows to use a combination of "data only, drop indexes" so that when
the target database already exists, pgloader will use the existing schema
and still DROP INDEX before loading the data and do the CREATE INDEX dance
in parallel and all at the end of it.

Also, as I couldn't reproduce neither #539 (which is good, it's supposed to
be fixed now) nor #550 (that was open due to a regression): fixes #550.
2017-07-04 00:15:58 +02:00
Dimitri Fontaine
fc01c7acc9 Fix DBF handling of "empty" date strings.
Blind code a fix for an error when parsing empty date strings in a DBF file.
The small amount of information is surprising, I can't quite figure out
which input string can produce " - - " with the previous coding of
db3-date-to-pgsql-date.

Anyway, it seems easy enough to add some checks to a very optimistic
function and return nil when our checks aren't met.

Fixes #589, hopefully.
2017-06-30 13:37:36 +02:00
Dimitri Fontaine
1e436555a8 Refactor PostgreSQL conditions.
Use a single deftype postgresql-unavailable rather than copy/pasting the
same list of conditions in several places.
2017-06-29 14:08:52 +02:00
Dimitri Fontaine
60c1146e18 Assorted fixes.
Refrain from killing the Common Lisp image when doing interactive regression
testing if we typo'ed the regression test file name...
2017-06-29 12:35:40 +02:00
Dimitri Fontaine
cea82a6aa8 Reconnect to PostgreSQL in case of connection lost.
It may happen that PostgreSQL is restarted while pgloader is running, or
that for some other reason we lose the connection to the server, and in most
cases we know how to gracefully reconnect and retry, so just do so.

Fixes #546 initial report.
2017-06-29 12:34:34 +02:00
Dimitri Fontaine
f0d1f4ef8c Fix reduce usage with max function.
The (reduce #'max ...) requires an initial value to be provided, as the max
function wants at least 1 argument, as we can see here:

CL-USER> (handler-case (reduce #'max nil) (condition (e) (format t "~a" e)))
Too few arguments in call to #<Compiled-function MAX #x300000113C2F>:
0 arguments provided, at least 1 required.
2017-06-28 16:37:27 +02:00
Dimitri Fontaine
17a63e18ed Review "main" error handling.
The "main" function only gets used at the command line, and errors where not
cleanly reported to the users. Mainly because I almost never get to play
with pgloader that way, prefering a load command file and the REPL
environment, but that's not even acceptable as an excuse.

Now the binary program should be able to exit cleanly in all situations. In
testing, it may happens on unexpected erroneous situations that we quit
before printing all the messages in the monitoring queue, but at least now
we quit cleanly and with a non-zero exit status.

Fix #583.
2017-06-28 16:36:08 +02:00
Dimitri Fontaine
0549e74f6d Implement multiple reader per table for MySQL.
Experiment with the idea of splitting the read work in several concurrent
threads, where each reader is reading portions of the target table, using a
WHERE id <= x and id > y clause in its SELECT query.

For this to kick-in a number of conditions needs to be met, as described in
the documentation. The main interest might not be faster queries to overall
fetch the same data set, but better concurrency with as many readers as
writters and each couple its own dedicated queue.
2017-06-28 16:23:18 +02:00
Dimitri Fontaine
6d66280fa5 Review parallelism and memory behavior.
The previous patch made format-vector-row allocate its memory in one go
rather than byte after byte with vector-push-extend. In this patch we review
our usage of batches and parallelism.

Now the reader pushes each row directly to the lparallel queue and writers
concurrently consume from it, cook batches in COPY format, and then send
that chunk of data down to PostgreSQL. When looking at runtime profiles, the
time spent writing in PostgreSQL is a fraction of the time spent reading
from MySQL, so we consider that the writing thread has enough time to do the
data mungling without slowing us down.

The most interesting factor here is the memory behavor of pgloader, which
seems more stable than before, and easier to cope with for SBCL's GC.

Note that batch concurrency is no more, replaced by prefetch rows: the
reader thread no longer build batches and the count of items in the reader
queue is now a number a rows, not of batches of them.

Anyway, with this patch in I can't reproduce the following issues:

Fixes #337, Fixes #420.
2017-06-27 23:10:33 +02:00
Dimitri Fontaine
7f737a5f55 Reduce memory allocation in format-vector-row.
This function is used on every bit of data we send down to PostgreSQL, so I
have good hopes of reducing its memory allocation having an impact on
loading times. In particular for sizeable data sets.
2017-06-27 15:31:49 +02:00
Dimitri Fontaine
46d6f339df Add a user friendly message about what's happening...
Still in the abnormal termination case. pgloader might get stuck and if the
user knows it's waiting for threads to complete, they might be less worried
about the situation and opportunity to kill pgloader...
2017-06-27 11:19:07 +02:00
Dimitri Fontaine
2341ef195d Review abnormal termination code path.
In case of an exceptional condition leading to termination of the pgloader
program we tried to use log-message after the monitor should have been
closed. Also the 0.3s delay to let latests messages out looks like a poor
design.

This patch attempts to remedy both the situation: refrain from using a
closed down monitoring thread, and properly wait until it's done before
returning to the shell.

See #583.
2017-06-27 10:45:54 +02:00
Dimitri Fontaine
352f4adc8d Implement support for MySQL SET parameters.
pgloader had support for PostgreSQL SET parameters (gucs) from the
beginning, and in the same vein it might be necessary to tweak MySQL
connection parameters, and allow pgloader users to control them.

See #337 and #420 where net_read_timeout and net_write_timeout might need to
be set in order to be able to complete the migration, due to high volumes of
data being processed.
2017-06-27 10:00:47 +02:00
Otheus
b5a593af14 Update INSTALL.md (#585)
Add instructions for redhat/centos7
2017-06-21 21:27:27 +02:00
Dimitri Fontaine
a222a82f66 Improve docs on pgloader.io.
In the SQLite and MySQL cases, expand on the simple case before detailing
the command language. With our solid defaults, most times a single command
line with the source and target connection strings are going to be all you
need.
2017-06-20 16:24:25 +02:00
Dimitri Fontaine
cae86015a0 Let's be more specific about the license.
Upon GitHub's suggestion, add a LICENSE file to make it clear we are using
The PostgreSQL License. Assign the copyright to The PostgreSQL Global
Development Group as it's done for PostgreSQL, as it seems to be the right
thing to do.
2017-06-17 19:21:33 +02:00
Dimitri Fontaine
e11ccf7bb7 Fix on-error-stop signaling.
To properly handle on-error-stop condition, make it a specific pgloader
condition with a specific handling behavior. In passing add some more log
messages for surprising conditions.

Fix #546.
2017-06-17 19:02:05 +02:00
Dimitri Fontaine
5faf8605ce Fix corner cases and how we log them.
In the prepare-pgsql-database method we were logging too much details, such
as DDL warnings on if-not-exists for successful queries. And those logs are
to be found in PostgreSQL server logs anyway.

Also fix trying to create or drop a "nil" schema.
2017-06-17 18:16:18 +02:00
Dimitri Fontaine
6c931975de Refrain from pushing too much logging trafic.
In this patch we hard-code some cases when we know the log message won't be
displayed anywhere so as to avoid sending it to the monitor thread. It
certainly is a modularity violation, but given the performance impact...
2017-06-17 18:12:33 +02:00
Dimitri Fontaine
422fab646a Typo-level fix.
Using ~s with extra quotes is quite disturbing at this place (logs only, but
still).
2017-06-17 17:23:44 +02:00
Dimitri Fontaine
7f55b21044 Improve support for http(s) resources.
The code used to take into account content-length HTTP header to load that
number of bytes in memory from the remote server. Not only it's better to
use a fixed size allocated-once buffer for that (now 4k), but also doing so
allows downloading content that you don't know the content-length of.

In passing tell the HTTP-URI parser rule that we also accept https:// as a
prefix, not just http://.

This allows running pgloader in such cases:

  $ pgloader https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite_AutoIncrementPKs.sqlite pgsql:///chinook

And it just works!
2017-06-17 16:48:15 +02:00
Dimitri Fontaine
b301aa9394 Review create-schemas default behavior.
Get back in line with what the documentation says, and also fix the case for
default MySQL migrations now that we target a PostgreSQL schema with the
same name as the MySQL database name.

Open question yet: should we also register the new schema on the search_path
by default?

  ALTER DATABASE ... SET search_path TO public, newschema, ...;

Is it more of a POLA violation to alter the search_path or to not do it?

Fix #582.
2017-06-16 09:01:18 +02:00
Peter Matseykanets
cd16faee8a brew insist on capital --HEAD
Reword our documentation to use the uppercase variant so that users may copy and paste and benefit.

Fix #581.
2017-06-16 08:43:54 +02:00
Dimitri Fontaine
b3cb7b256d Travis: let's actually use the new EXTRA_OPTS. 2017-06-14 21:32:41 +02:00
Dimitri Fontaine
c02defa5f0 Travis: explicitely pass down the CL variable.
It seems that the test/Makefile didn't get the memo.
2017-06-14 21:25:18 +02:00
Dimitri Fontaine
1469789ede Try to get more information from CCL in testing.
The “magic” options --batch and --heap-reserve will be processed by CCL
itself before pgloader gets to see them, so try that in the testing
environment.
2017-06-14 21:12:54 +02:00
Dimitri Fontaine
de9b43c332 Add support for the MS-SYBDATE datatype.
Fixes #568, thanks to a test case being provided!
2017-06-14 21:02:00 +02:00
Dimitri Fontaine
2c644d55f2 Add --batch to CCL run options.
This option provides lots of information when it crashes, and should help us
with understanding Travis and DockerHub errors with CCL.
2017-06-14 11:49:22 +02:00
Adrian Vondendriesch
90a33b4b4c MSSQL: Add ON UPDATE / DELETE support for fkeys (#580)
The former query to find foreign key constraints doesn't consider ON
UPDATE and ON DELETE rules.
2017-06-13 12:03:51 +02:00
Adrian Vondendriesch
d966d37579 MSSQL: Fix Default value translation for getdate() (#576) (#577)
Currently the default value getdate() is replaced by 'now' which creates
statements like:
  CREATE TABLE ... created timestamp 'now' ...
which leads to table definitions like:
  default '2017-06-12 17:54:04.890129'::timestamp without time zone

This is because 'now' is evaluated when creating the table.

This commit fixes the issue by using CURRENT_TIMESTAMP as default
instead of 'now'.
2017-06-12 21:42:35 +02:00
Chris Bandy
b59421cb48 Multiple Travis CI jobs (#575)
* Test with multiple versions of PostgreSQL in Travis

* Test with multiple implementations of Lisp in Travis
2017-06-11 13:25:48 +02:00
Chris Bandy
1a5194de1d Repair Travis CI builds (#574)
* Uninstall PostgreSQL during Travis setup

Recent build images start with PostgreSQL running. Uninstall it so we
can install and run a specific version.

* Skip authentication in Travis builds

The wrong combination of connection parameters will cause psql and other
utilities to prompt for a password, stalling the Travis build
indefinitely.

* Move PostgreSQL setup for Travis builds into script

* Use a newer version of SBCL in Travis builds

Recent versions of bordeaux-threads require ASDF >= 3.1
2017-06-10 12:06:40 +02:00
Adrian Vondendriesch
1f3659941e MSSQL: fix typmod conversion for "max" typemods (#573)
The previous commit makes it possible to convert typemods for various
text types. In MSSQL it's possible to create a column like varchar(max).
Internally this is reported as varchar(-1) which results in a CREATE
TABLE statement that contains e.g. varchar(-1).

This patch drops the typemod if it's -1 (max).

It's based on Dimitris patch slightly modified by myself.
2017-06-09 16:12:17 +02:00
Adrian Vondendriesch
d0c273a512 MSSQL: Add support for typemods of various text types (#572)
If a custom CAST rule is defined (e.g CAST type varchar to varchar) the
original typemod get's lost. This commit is based on Dimitris patch from
571 and adds typmod support for "char", "nchar", "varchar", "nvarchar"
and "binary".
2017-06-09 11:25:02 +02:00
Dimitri Fontaine
355aedfd72 Fix "drop default" casting rule.
The previous coding would discard any work done at the apply-casting-rules
step when adding source specific smarts about handling default, because of
what looks like negligence and bad tests. A test case scenario exists but
was not exercized :(

Fix that by defaulting the default value to the one given back at the
apply-casting-rules stage, where we apply the "drop default" clause.
2017-06-08 21:39:06 +02:00
Dimitri Fontaine
d74c9625a3 Clarify the code.
(unless (remove-if-not ...)) reads better as (when (notany ...)) so rewrite
the test that way. For reference and context see #563.
2017-06-08 13:39:38 +02:00
Dimitri Fontaine
776f8fcf6f Add support for SQLite implicit pkeys.
It turns out that in some cases SQLite will not list its primary key indexes
in the pragma index_list(), and that's related to an implementation detail
about using its internal btree structure when rowid can be exploited as the
integer pkey.

Reverse engineer that bahavior in pgloader so that the PostgreSQL schema
contains the primary keys even when they are implicit. In doing that we must
be careful that the pkeys might also appear explicitely, in which case we
refrain from declaring them twice.

SQLite catalogs are not my favorite, not to say hackish as hell.

Fixes #563.
2017-06-08 12:11:38 +02:00
Dimitri Fontaine
25e5ea9ac3 Refactor error handling in complete-pgsql-database.
Given new SQLite test case from issue #563 we see that pgloader doesn't
handle errors gracefully in post-copy stage. That's because the API were not
properly defined, we should use pgsql-execute-with-timing rather than other
construct here, because it allows the "on error resume next" behavior we
want with after load DDL statements.

See #563.
2017-06-08 12:09:11 +02:00
Dimitri Fontaine
9fb37bf513 Fix SQLite usage of sqlite_sequence catalog.
It turns out that this catalog table in SQLite may or may not exists
depending on whether the current schema actually uses the feature. So we
need to learn to query the catalogs about the catalogs before querying the
catalogs to learn about the current schema. Thanks SQLite.
2017-06-02 22:34:58 +02:00
Dimitri Fontaine
57a7353a94 Add a log entry before executing SQL blocks.
That seems helpful.
2017-06-02 22:34:25 +02:00
Dimitri Fontaine
c6b634caad Provide "on error stop" as a WITH option.
As seen in #546 it would be easier to be able to specify the option in the
load command directly rather than only at the command line. Here we go!
2017-06-01 16:43:09 +02:00
Dimitri Fontaine
45719645da Implement GumRoad payment for the Moral License.
Let's make it easy for interested parties to actually buy a license, and
offer several levels of “partnership” with the project. Be a Sponsor, a
Partner or even consider having pgloader custom development made for you.
Oracle™ support anyone?
2017-05-31 15:27:06 +02:00
Dimitri Fontaine
21208980fd Improve readme content about building from source.
As reported we still have some complex situations to deal with when buildind
from sources in some environments: windows and MacOXS macports are not in a
very good shape at the moment.

Add some good content in the README to better help people in those
environments get their build.

Fix #444.
2017-05-29 13:01:40 +02:00
Dimitri Fontaine
8f92cc5a7d Fix our SQL parser.
In order to support custom SQL files with several queries and psql like
advanced \i feature, we have our own internal SQL parser in pgloader. The
PostgreSQL variant of SQL is pretty complex and allows dollar-quoting and
other subtleties that we need to take care of.

Here we fix the case when we have a dollar sign ($) as part of a single
quoted text (such as a regexp), so both not a new dollar-quoting tag and a
part of a quoted text being read.

In passing we also fix reading double-quoted identifiers, even when they
contain a dollar sign. After all the following is totally supported by
PostgreSQL:

  create table dollar("$id" serial, foo text);
  select "$id", foo from dollar;

Fix #561.
2017-05-29 12:42:12 +02:00
Dimitri Fontaine
1f9a0b6391 Handle SQLite Sequences (auto_increment).
It turns out that the SQLite catalogs have a way of registering if a column
is an auto_increment. You have to look into the sqlite_sequence catalog for
the name of the table the column is found into, and when there's a non-zero
entry there and the table as a single pk-id column of integer type then it's
safe to assume that we have an "auto_increment" column.

The current way to handle this property is suboptimal in pgloader too where
we need to attach an "extra" slot to our column representation with a value
of the "auto_increment" string. But at least it's easy to hack the code
here... anyway.

Fix #556.
2017-05-21 18:43:10 +02:00
Dimitri Fontaine
3b4af49e22 Implement ALTER SCHEMA and ALTER TABLE for SQLite.
It turns out we forgot to add support for internal catalog munging clauses
to SQLite support. The catalogs being normalized means there's no extra work
here other than allowing the parser to accept those clauses and then pass
them over to our generic `copy-database' method implementation.

It is to be noted that SQLite has no support for schemas as per the standard
and PostgreSQL, so that when we inspect the database schema we create a nil
entry here. It's then not possible to ALTER SCHEMA nil RENAME TO 'target';
unfortunately, but it's easy enough to SET search_path to 'target' anyway,
as shown in the modified test case.

Fix #552.
2017-05-14 20:47:01 +02:00
Dimitri Fontaine
65cdc48c1e Fix error conditions for unrecognized source.
When the source is not recognized, pgloader would not always output a useful
error message with the hint about using --type, as per #248. Here we fix the
conditions applying to this error message.
2017-05-12 13:08:30 +02:00
Dimitri Fontaine
fe2e1ee956 Fix comments handling in IXF support.
There's no need to add empty string comments, guard against doing that.
2017-05-06 15:10:40 +02:00
Dimitri Fontaine
e7afe993fa Review database migration logic and options again.
In #539 it appears that we fail to honor some actions, and it seems to be
because of sloppy reasonning in how to make sense of all of them. It could
well be that we have too many options for them to make sense in all possible
combinations, but for now it looks safe to bet on an easy fix...
2017-05-06 14:45:05 +02:00
Mikael Sand
3c4e64ed26 Fix spelling error in Windows-only code path (#545)
Fix spelling error for uiop:make-pathname* key by changing :direction to :directory
2017-04-30 19:53:53 +02:00
Dimitri Fontaine
8254d63453 Fix incorrect per-table total time metrics.
The concurrency nature of pgloader made it non obvious where to implement
the timers properly, and as a result the tracking of how long it took to
actually transfer the data was... just wrong.

Rather than trying to measure the time spent in any particular piece of the
code, we now emit "start" and "stop" stats messages to the monitor thread at
the right places (which are way easier to find, in the worker threads) and
have the monitor figure out how long it took really.

Fix #506.
2017-04-30 18:09:50 +02:00
Dimitri Fontaine
20ea1d78c4 Improve default summary readability.
Now that we have fixed the output of the per-table total timing, we can only
show that timing by default. With more verbosity pgloader will add the extra
columns, and in computer oriented formats (json, csv, copy) all the details
are always provided of course.

See #506.
2017-04-30 18:09:50 +02:00
geethaRam
0e12d77a7f Update pgloader.spec (#537)
Updated version in spec
2017-04-17 23:20:14 +02:00
Dimitri Fontaine
9b4bbdfef7 Review --load-lisp-file error handling.
The handler-case form installed would catch any non-fatal warning and would
also fail to display any error to the user. Both are wrong behavior that
this patch fixes, using *error-output* (that's stderr) explicitely for any
thing that may happen while loading the user provided code.

Fix #526.
2017-04-16 21:22:46 +02:00
Dimitri Fontaine
538464f078 Avoid operator is not unique errors.
When the intarray extension is installed our PostgreSQL catalog query fails
because we now have more than one operator solving smallint[] <@ smallint[].
It is easy to avoid that problem by casting to integer[], smallint being an
implementation detail here anyway.

Fix #532.
2017-04-06 23:55:06 +02:00
Dimitri Fontaine
0219f55071 Review DROP INDEX objects quoting.
Force double-quoting of objects name in DROP INDEX commands by using the
format directive ~s. The names of the objects we are dropping usually come
from a PostgreSQL catalog, but still might contain force-quote conditions
like starting with a number, as shown in #530.

This fix certainly means we will have to review all the DDL formatting we do
in pgloader and apply a single method of quoting all along. The simpler one
is of course to force quote every object name in "", but it might not be the
smartest one (what if some sources are sending already quoted object names,
that needs a check), and it's certainly not the prettier way to go at it:
people usually like to avoid unnecessary quotes, calling them clutter.

Fix #530.
2017-04-01 22:37:26 +02:00
Dimitri Fontaine
e2bc7e4fd4 Fix github language statistics.
As documented in https://github.com/github/linguist#overrides and from the
conversation in https://github.com/github/linguist/issues/3540 we add a
.gitattributes file to the project wherein we pretend that the sql files are
all vendored-in.

This should allow GitHub to realize that pgloader is all about Common Lisp
and not a single line of PLpgSQL...
2017-03-26 11:26:29 +02:00
Dimitri Fontaine
b2f9590f58 Add support for MS SQL XML data type.
Given a test case and some reading of the FreeTDS source code, it appears
that the XML data type is sent on the wire as (unicode) text. This patch
makes pgloader aware of that and also revisit the choice of casting XML to
PostgreSQL XML data type (thanks to the test case where we see it just works
without surprise).

Fix #503.
2017-03-25 21:26:16 +01:00
Dimitri Fontaine
296e571e27 Fix MS SQL tinyint identity support.
Add a cast rule to support tinyint being an “identity” type in MS SQL, which
means using a sequence to derive its values from. We didn't address the
whole MS SQL integer type tower here, and suspect we will have to add more
in the future.

Fix #528 where I could have access to a test case and easily reproduce the
bug, thanks!
2017-03-22 11:38:40 +01:00
Dimitri Fontaine
940fc63a5e Distribute *root-dir* to all threads.
The creation of the reject and data files didn't happen in the
right *root-dir* setting for lack of sending the main value to the worker
threads.
2017-03-18 18:51:22 +01:00
Dimitri Fontaine
ab7e77c2d0 Fix double transformation call in CSV projections.
In advanced projections it could be that we call the transformation function
for some input fields twice. This is a bug that manifest in particular when
the output of the transformation can't be used/parsed again by the same
function as shown in the bug reported.

Fix #523.
2017-03-04 15:55:08 +01:00
Dimitri Fontaine
3fac222432 Fix MSSQL index column names quoting.
We have to pay attention that column names in MS SQL don't follow the same
rules as in PostgreSQL and may e.g. begin with numbers. Apply identifier
case and rules to index column names too.
2017-03-03 21:30:58 +01:00
Dimitri Fontaine
1023577f50 Review internal database migration logic.
Many options are now available to pgloader users, including short cuts that
where not defined clearly enough. That could result in stupid things being
done at times.

In particular, when picking the "data only" option then indexes are not to
be dropped before loading the data, but pgloader would still try and create
them again at the end of the load, because the option that controls that
behavior default to true and is not impacted by the "data only" choice.

In this patch we review the logic and ensure it's applied in the same
fashion in the different phases of the database migration: preparation,
copying, rebuilding of indexes and completion of the database model.

See also 96b2af6b2a2b163f7e9e3c0ba744da1733b23979 where we began fixing
oddities but didn't go far enough.
2017-02-26 14:48:36 +01:00
Dimitri Fontaine
8ec2ea04db Add support for MySQL geometry points.
The new version of the sakila database uses geometry typed columns that
contain POINT data. Add support for that kind of data by copying what we did
already for POINT datatype.
2017-02-25 21:52:41 +01:00
Dimitri Fontaine
9e2b95d9b7 Implement support for PostgreSQL storage parameters.
In PostgreSQL it is possible at CREATE TABLE time to set some extra storage
parameters, the most useful of them in the context of pgloader being the
FILLFACTOR. For the setting to be useful, it needs to be positionned at
CREATE TABLE time, before we load the data.

The BEFORE LOAD clause of the pgloader command allows to run SQL scripts
that will be executed before the load, and even before the creation of the
target schema when pgloader does that, which is nice for other use case.

Here we implement a new `ALTER TABLE` rule that one can set in the pgloader
command in order to change storage parameters at CREATE TABLE time:

  ALTER TABLE NAMES MATCHING ~/\./ SET (fillfactor='40')

Fix #516.
2017-02-25 21:49:06 +01:00
Dimitri Fontaine
57dd9fcf47 Add int as an alias for integer.
We cast MS SQL "int" type to "integer" in PostgreSQL, so add an entry in our
type name mapping where they are known equivalent to avoid WARNINGs about
the situation in DATA ONLY loads.
2017-02-25 17:54:57 +01:00
Dimitri Fontaine
5fd1e9f3aa Fix catalog merge hasards.
When reading table names from PostgreSQL, we might find some that need
systematic quoting (such as names that begin with a digit). In that case,
when later comparing the catalogs to match source database table names
against PostgreSQL catalog table names, we need to unquote the PostgreSQL
table name we are using.

In passing, force the *identifier-case* to :none when reading object names
from the PostgreSQL catalogs.
2017-02-25 17:53:08 +01:00
Dimitri Fontaine
96b2af6b2a Fix a hang scenario in schema-only.
The parallelism in pgloader is now smart enough to begin fetching data from
the next table while the previous one is still not done being written down
to PostgreSQL, but when doing so I introduced a bug in the way indexes are
taken care of.

Specifically, in schema-only mode of operations, we would wait for indexes
we skipped creating. The skipping is the bug here, so make sure we create
indexes even when we don't want to copy any data over.
2017-02-25 17:09:07 +01:00
Dimitri Fontaine
2f7169e286 Fix MS SQL N'' default values.
MS SQL apparently sends default values as Nvarchar, and in this case it
means we have to deal ourselves with the N'' representation of it.
2017-02-25 16:14:26 +01:00
Jan Moringen
57bc1ca886 Shadow symbols NAMESTRING, NUMBER and INLINE in pgloader.parser package (#515)
Defining rules on standard symbols like CL:NAMESTRING is a bad idea
since other systems may do the same, inadvertently overwriting each
other's rules.

Furthermore, future esrap versions will probably prevent defining
rules whose names are symbols in locked packages, making this change
mandatory.
2017-02-12 15:14:34 +01:00
Dimitri Fontaine
024579c60d Fix SBCL version requirements.
As we now depend on recent enough version of ASDF in some of our build
dependencies, that raises the bar to ABCL 1.2.5 or newer now.

Fixes #497.
2017-01-28 18:17:19 +01:00
Dimitri Fontaine
6bd17f45da Add support for MS SQL smalldatatime data type.
Availability of a test case for MS SQL allows to make progress on this
limitation and add support to the smalldatetime data type. It is
converted server-side with the same CONVERT expression as the longer
datetime datatype.

Fixes #431.
2017-01-28 18:08:55 +01:00
Dimitri Fontaine
a799cd5f5f Improve error handling for MS SQL.
In particular, implement more solid handling of poorly encoded data or
badly setup connections, by reporting the error and continuing the load.
2017-01-28 17:47:44 +01:00
Dimitri Fontaine
ddda2f92ca Force column ordering in SQLite support.
In the case of targetting an already existing PostgreSQL database,
columns might have been reordered. Add the column name list to the COPY
command we send so that we figure the mapping out automatically.

Fixes #509.
2017-01-28 17:45:33 +01:00
Dimitri Fontaine
b54ca576cb Raise some log messages.
We should be able to follow the progress more easily at the log level
NOTICE, so raise some log messages from INFO to NOTICE.
2017-01-28 17:44:18 +01:00
Dimitri Fontaine
ed217b7b28 Add some docs about FreeTDS and encoding.
It turns out that it's possible and not too complex, when using the
FreeTDS driver, to enforce the client encoding for MS SQL to be utf-8.
Document how to tweak ~/.freetds.conf to that end.
2017-01-27 22:16:59 +01:00
Dimitri Fontaine
1d025bcd5a Fix log levels.
It looks like we missed the INFO level messages in the DEBUG output.
2017-01-23 21:52:38 +01:00
Dimitri Fontaine
bd84c6fec9 Fix default value handling in MS SQL.
When the column is known to be non-nullable, refrain from adding a null
default value to it. This also fixes the case of casting from an

  [int] IDENTITY(1,1) NOT NULL

That otherwise did get transformed into a

  bigserial not null default NULL

Causing then the error

  Database error 42601: multiple default values specified for column ... of table ...
2017-01-23 21:50:16 +01:00
Dimitri Fontaine
c0f9569ddd In passing aesthetic concerns. 2017-01-23 21:49:42 +01:00
Dimitri Fontaine
1d35290914 Assorted fixes for MS SQL support.
When updating the catalog support we forgot to fix the references to the
index and fkey name slots that are now provided centrally for the
catalog of all database source types.

Again, we don't have unit test cases for MS SQL, so that's a blind
fix (but at least that compiles).

See #343.
2017-01-10 21:19:29 +01:00
Dimitri Fontaine
dbf7d6e48f Don't double-quote identifiers in catalog queries.
Avoid double quoting the schema names when used in PostgreSQL catalog
queries, where the identifiers are used as literal values and need to be
single-quoted.

Fix #476, again.
2017-01-10 21:12:34 +01:00
Dimitri Fontaine
8da09d7bed Log PostgreSQL Catalog queries at SQL log level.
See #476 where it would have been helpful to see the PostgreSQL catalog
queries with `--log-min-messages sql` in the bug report. Also more
generally useful.
2017-01-10 21:12:34 +01:00
Dimitri Fontaine
17536e84a4 Create CNAME 2017-01-06 21:37:59 +01:00
Dimitri Fontaine
effa916b31 Improve parallelism setup documentation.
The code comment displayed in the release notes for 3.3.1 is reported to
be better at explaining the concurrency control than what we had in the
main documentation, so add it there.

Fix #496.
2017-01-03 23:13:01 +01:00
Dimitri Fontaine
21a10235db Refrain from issuing the summary twice.
Now that we have a proper flush system for reporting the summary at the
proper time (see 7c5396f0975be405910d66f4b5aedc89acd75c1d), refrain from
also taking care of the reporting when stopping the monitor.

Adapt the regression driver code to flush the summary after loading the
expected data, which also provides better output.

When the summary output is sent to a file, that would also create a
backup file and replace our summary with an empty new file at monitor
stop...

Fixes #499.
2017-01-03 23:07:58 +01:00
Dimitri Fontaine
b239e6b556 Fix #498. 2017-01-03 22:28:58 +01:00
Dimitri Fontaine
381ba18b50 Add a new log level: SQL.
This sits between NOTICE and INFO, allowing to have a complete log of
the SQL queries sent to the server while avoiding the very verbose
trafic of the DEBUG log level.

See #498.
2017-01-03 22:27:17 +01:00
Dimitri Fontaine
4931604361 Allow ALTER SCHEMA command for MySQL.
This pgloader command allows to migrate tables while changing the schema
they are found into in between their MySQL source database and their
PostgreSQL target database.

This changes the default behavior of pgloader with MySQL from always
targetting the 'public' schema to targetting by default a schema named
the same as the MySQL database. You can revert to the old behavior by
adding a rule:

   ALTER SCHEMA 'dbname' RENAME TO 'public

We might want to add a patch to re-install the default behavior later.

Also see #489 where it used not to be possible to rename the schema at
migration time, causing strange errors (you need to spot NIL as the
schema name in the "failed to find target table" messages.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
bdaacae3e7 Fix Primary Keys count.
That was broken in a recent patch refactoring the PostgreSQL SQL execute
API that now accepts a list of commands to execute.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
320a545533 Fix SQL types creation: consider views too.
When migrating views from e.g. MySQL it is necessary to consider the
user defined SQL types (ENUMs) those views might be using.
2016-12-18 19:31:21 +01:00
Dimitri Fontaine
ad56cf808b Fix PostgreSQL index naming.
A PostgreSQL index is always created in the same schema as the table it
is defined against, and the CREATE INDEX command doesn't accept schema
qualified index names.
2016-12-18 19:31:21 +01:00
Andy Freeland
9a0c50f700 Make sure EPEL is enabled when installing SBCL (#494) 2016-12-17 16:30:57 +01:00
Dimitri Fontaine
1c927beb81 Fix cl-postgres packaging (typo). 2016-12-12 12:04:40 +01:00
Dimitri Fontaine
37fc4ba550 Back to development mode. 2016-12-04 14:09:36 +01:00
342 changed files with 24193 additions and 23140 deletions

View File

@ -1,3 +1,5 @@
.git
.vagrant
build
Dockerfile
Dockerfile.ccl

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
test/**/*.sql linguist-vendored

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: dimitri

33
.github/workflows/debian-ci.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Debian Autopkgtest
on:
pull_request: {}
push: {}
jobs:
debian-build:
# focal is too old, use jammy
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install postgresql-common
run: sudo apt-get install -y postgresql-common
- name: Install pgapt repository
run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
- name: Install build-dependencies
run: sudo apt-get build-dep -y .
- name: Build pgloader.deb
run: dpkg-buildpackage --no-sign --buildinfo-option=--version -b
- name: Install autopkgtest
run: sudo apt-get install -y autopkgtest
- name: Autopkgtest
run: sudo autopkgtest ./ ../pgloader_*_amd64.deb -- null

100
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,100 @@
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Install the cosign tool (not used on PR, still installed)
# https://github.com/sigstore/cosign-installer
- name: Install cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v2.2.3'
- name: Check cosign version
run: cosign version
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3.6.2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=semver,pattern={{version}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: cosign sign --yes ${TAGS}
env:
TAGS: ${{ steps.meta.outputs.tags }}
# should use @${{ steps.build-and-push.outputs.digest }}
# but that leads to "entity not found in registry"
COSIGN_EXPERIMENTAL: "true"

5
.gitignore vendored
View File

@ -2,6 +2,7 @@
local-data
pgloader.html
pgloader.pdf
debian/home/
debian/pgloader.debhelper.log
debian/pgloader.substvars
debian/pgloader/
@ -14,3 +15,7 @@ web/howto/mysql.html
web/howto/pgloader.1.html
web/howto/quickstart.html
web/howto/sqlite.html
.DS_Store
system-index.txt
buildapp.log
docs/_build

11
.readthedocs.yaml Normal file
View File

@ -0,0 +1,11 @@
version: 2
# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# Explicitly set the version of Python and its requirements
python:
version: 3.7
install:
- requirements: docs/requirements.txt

72
.travis.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
set -eu
lisp_install() {
case "$LISP" in
ccl)
ccl_checksum='08e885e8c2bb6e4abd42b8e8e2b60f257c6929eb34b8ec87ca1ecf848fac6d70'
ccl_version='1.11'
remote_file "/tmp/ccl-${ccl_version}.tgz" "https://github.com/Clozure/ccl/releases/download/v${ccl_version}/ccl-${ccl_version}-linuxx86.tar.gz" "$ccl_checksum"
tar --file "/tmp/ccl-${ccl_version}.tgz" --extract --exclude='.svn' --directory '/tmp'
sudo mv --no-target-directory '/tmp/ccl' '/usr/local/src/ccl'
sudo ln --no-dereference --force --symbolic "/usr/local/src/ccl/scripts/ccl64" '/usr/local/bin/ccl'
;;
sbcl)
sbcl_checksum='22ccd9409b2ea16d4be69235c5ad5fde833452955cb24483815312d3b1d7401c'
sbcl_version='1.5.2'
remote_file "/tmp/sbcl-${sbcl_version}.tgz" "http://prdownloads.sourceforge.net/sbcl/sbcl-${sbcl_version}-x86-64-linux-binary.tar.bz2" "$sbcl_checksum"
tar --file "/tmp/sbcl-${sbcl_version}.tgz" --extract --directory '/tmp'
( cd "/tmp/sbcl-${sbcl_version}-x86-64-linux" && sudo ./install.sh )
;;
*)
echo "Unrecognized Lisp: '$LISP'"
exit 1
;;
esac
}
pgdg_repositories() {
local sourcelist='sources.list.d/pgdg.list'
sudo tee "/etc/apt/$sourcelist" <<-repositories
deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main
deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg-testing main 10
repositories
sudo apt-key adv --keyserver 'hkp://ha.pool.sks-keyservers.net' --recv-keys 'ACCC4CF8'
sudo apt-get -o Dir::Etc::sourcelist="$sourcelist" -o Dir::Etc::sourceparts='-' -o APT::Get::List-Cleanup='0' update
}
postgresql_install() {
if [ -z "${PGVERSION:-}" ]; then
echo 'PGVERSION environment variable not set.';
exit 1
fi
xargs sudo apt-get -y install <<-packages
postgresql-${PGVERSION}
postgresql-${PGVERSION}-ip4r
packages
sudo tee /etc/postgresql/${PGVERSION}/main/pg_hba.conf > /dev/null <<-config
local all all trust
host all all 127.0.0.1/32 trust
config
sudo service postgresql restart
}
remote_file() {
local target="$1" origin="$2" sum="$3"
local check="shasum --algorithm $(( 4 * ${#sum} )) --check"
local filesum="$sum $target"
curl --location --output "$target" "$origin" && $check <<< "$filesum"
}
$1

View File

@ -1,20 +1,38 @@
language: common-lisp
language: shell
os: linux
dist: xenial
env:
matrix:
- LISP=ccl PGVERSION=9.6
- LISP=ccl PGVERSION=10
- LISP=ccl PGVERSION=11
- LISP=ccl PGVERSION=12
- LISP=ccl PGVERSION=13
- LISP=sbcl PGVERSION=9.6
- LISP=sbcl PGVERSION=10
- LISP=sbcl PGVERSION=11
- LISP=sbcl PGVERSION=12
- LISP=sbcl PGVERSION=13
install:
- sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-keys ACCC4CF8
- echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
- sudo apt-get update
- sudo apt-get install -y cl-asdf sbcl unzip libsqlite3-dev gawk freetds-dev
- sudo apt-get install -y postgresql-9.1-ip4r
- ./.travis.sh lisp_install
- ./.travis.sh pgdg_repositories
- ./.travis.sh postgresql_install
- sudo apt-get install -y unzip libsqlite3-dev gawk freetds-dev
before_script:
- sudo -u postgres createuser -S -R -D -E -l pgloader
- sudo -u postgres createdb -E UTF8 -O pgloader -hlocalhost pgloader
- sudo -u postgres psql -h localhost -d pgloader -c "create extension ip4r;"
- PGUSER=pgloader psql -h localhost -d pgloader -c "create schema expected;"
- PGUSER=pgloader psql -h localhost -d pgloader -c "create schema err;"
- PGUSER=postgres createuser -S -R -D -E -l pgloader
- PGUSER=postgres createdb -E UTF8 -O pgloader pgloader
- PGUSER=postgres psql -d pgloader -c "create extension ip4r;"
- PGUSER=pgloader psql -d pgloader -c "create schema expected;"
- PGUSER=pgloader psql -d pgloader -c "create schema err;"
- make --version
- make
- make "CL=$LISP" clones save
script:
- PGUSER=pgloader make check
- PGUSER=pgloader make "CL=$LISP" check-saved
notifications:
email:
- dim@tapoueh.org

View File

@ -1,15 +1,53 @@
FROM debian:jessie
MAINTAINER Dimitri Fontaine <dim@tapoueh.org>
FROM debian:bookworm-slim AS builder
RUN apt-get update
RUN apt-get install -y wget curl make git bzip2 time libzip-dev libssl1.0.0 openssl
RUN apt-get install -y patch unzip libsqlite3-dev gawk freetds-dev sbcl
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
freetds-dev \
gawk \
git \
libsqlite3-dev \
libssl3 \
libzip-dev \
make \
openssl \
patch \
sbcl \
time \
unzip \
wget \
cl-ironclad \
cl-babel \
&& rm -rf /var/lib/apt/lists/*
ADD ./ /opt/src/pgloader
WORKDIR /opt/src/pgloader
COPY ./ /opt/src/pgloader
# build/ is in the .dockerignore file, but we actually need it now
RUN mkdir -p build/bin
RUN make
ARG DYNSIZE=16384
RUN cp /opt/src/pgloader/build/bin/pgloader /usr/local/bin
RUN mkdir -p /opt/src/pgloader/build/bin \
&& cd /opt/src/pgloader \
&& make DYNSIZE=$DYNSIZE clones save
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
freetds-dev \
gawk \
libsqlite3-dev \
libzip-dev \
make \
sbcl \
unzip \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/src/pgloader/build/bin/pgloader /usr/local/bin
ADD conf/freetds.conf /etc/freetds/freetds.conf
LABEL maintainer="Dimitri Fontaine <dim@tapoueh.org>"

View File

@ -1,19 +1,53 @@
FROM debian:jessie
MAINTAINER Dimitri Fontaine <dim@tapoueh.org>
FROM debian:bookworm-slim as builder
RUN apt-get update
RUN apt-get install -y wget curl make git bzip2 time libzip-dev libssl1.0.0 openssl
RUN apt-get install -y patch unzip libsqlite3-dev gawk freetds-dev subversion
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
freetds-dev \
gawk \
git \
libsqlite3-dev \
libssl3 \
libzip-dev \
make \
openssl \
patch \
time \
unzip \
wget \
cl-ironclad \
cl-babel \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/src
RUN svn co http://svn.clozure.com/publicsvn/openmcl/release/1.11/linuxx86/ccl
RUN cp /usr/local/src/ccl/scripts/ccl64 /usr/local/bin/ccl
RUN curl -SL https://github.com/Clozure/ccl/releases/download/v1.12/ccl-1.12-linuxx86.tar.gz \
| tar xz -C /usr/local/src/ \
&& mv /usr/local/src/ccl/scripts/ccl64 /usr/local/bin/ccl
ADD ./ /opt/src/pgloader
WORKDIR /opt/src/pgloader
COPY ./ /opt/src/pgloader
# build/ is in the .dockerignore file, but we actually need it now
RUN mkdir -p build/bin
RUN make CL=ccl DYNSIZE=256
ARG DYNSIZE=256
RUN cp /opt/src/pgloader/build/bin/pgloader /usr/local/bin
RUN mkdir -p /opt/src/pgloader/build/bin \
&& cd /opt/src/pgloader \
&& make CL=ccl DYNSIZE=$DYNSIZE clones save
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
freetds-dev \
gawk \
libsqlite3-dev \
libssl3 \
libzip-dev \
make \
sbcl \
unzip \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/src/pgloader/build/bin/pgloader /usr/local/bin
LABEL maintainer="Dimitri Fontaine <dim@tapoueh.org>"

View File

@ -2,7 +2,7 @@
pgloader version 3.x is written in Common Lisp.
## The lisp parts
## Dependencies
The steps depend on the OS you are currently using.
@ -23,7 +23,49 @@ You will note in particular:
We need a recent enough [SBCL](http://sbcl.org/) version and that means
backporting the one found in `sid` rather than using the very old one found
in current *stable* debian release. See `bootstrap-debian.sh` for details
about how to backport a recent enough SBCL here (1.1.14 or newer).
about how to backport a recent enough SBCL here (1.2.5 or newer).
### Redhat / CentOS
To build and install pgloader the Steel Bank Common Lisp package (sbcl) from EPEL,
and the freetds packages are required.
With RHEL/CentOS 6, if the packaged version of sbcl isn't >=1.3.6, you'll need
to build it from source.
It is recommended to build the RPM yourself, see below, to ensure that all installed
files are properly tracked and that you can safely update to newer versions of
pgloader as they're released.
To do an adhoc build and install run `boostrap-centos.sh` for CentOS 6 or
`bootstrap-centos7.sh` for CentOS 7 to install the required dependencies.
[Build pgloader](INSTALL.md#building-pgloader).
#### rpmbuild
The spec file in the root of the pgloader repository can be used to build your
own RPM. For production deployments it is recommended that you build this RPM on
a dedicated build box and then copy the RPM to your production environment for
use; it is considered bad practice to have compilers and build tools present in
production environments.
1. Install the [EPEL repo](https://fedoraproject.org/wiki/EPEL#Quickstart).
1. Install rpmbuild dependencies:
sudo yum -y install yum-utils rpmdevtools @"Development Tools"
1. Install pgloader build dependencies:
sudo yum-builddep pgloader.spec
1. Download pgloader source:
spectool -g -R pgloader.spec
1. Build the source and binary RPMs (see `rpmbuild --help` for other build options):
rpmbuild -ba pgloader.spec
### Mac OS X

96
ISSUE_TEMPLATE.md Normal file
View File

@ -0,0 +1,96 @@
Thanks for contributing to [pgloader](https://pgloader.io) by reporting an
issue! Reporting an issue is the only way we can solve problems, fix bugs,
and improve both the software and its user experience in general.
The best bug reports follow those 3 simple steps:
1. show what you did,
2. show the result you got,
3. explain how the result is not what you expected.
In the case of pgloader, here's the information I will need to read in your
bug report. Having all of this is a big help, and often means the bug you
reported can be fixed very efficiently as soon as I get to it.
Please provide the following information:
<!-- delete text above this line -->
- [ ] pgloader --version
```
<fill pgloader version here>
```
- [ ] did you test a fresh compile from the source tree?
Compiling pgloader from sources is documented in the
[README](https://github.com/dimitri/pgloader#build-from-sources), it's
easy to do, and if patches are to be made to fix your bug, you're going
to have to build from sources to get the fix anyway…
- [ ] did you search for other similar issues?
- [ ] how can I reproduce the bug?
Incude a self-contained pgloader command file.
If you're loading from a database, consider attaching a database dump to
your issue. For MySQL, use `mysqldump`. For SQLite, just send over your
source file, that's easy. Maybe be the one with your production data, of
course, the one with just the sample of data that allows me to reproduce
your bug.
When using a proprietary database system as a source, consider creating
a sample database on some Cloud service or somewhere you can then give
me access to, and see my email address on my GitHub profile to send me
the credentials. Still open a public issue for tracking and as
documentation for other users.
```
--
-- EDIT THIS FILE TO MATCH YOUR BUG REPORT
--
LOAD CSV
FROM INLINE with encoding 'ascii'
INTO postgresql:///pgloader
TARGET TABLE jordane
WITH truncate,
fields terminated by '|',
fields not enclosed,
fields escaped by backslash-quote
SET work_mem to '128MB',
standard_conforming_strings to 'on'
BEFORE LOAD DO
$$ drop table if exists jordane; $$,
$$ CREATE TABLE jordane
(
"NOM" character(20),
"PRENOM" character(20)
)
$$;
BORDET|Jordane
BORDET|Audrey
LASTNAME|"opening quote
BONNIER|testprenombe~aucouptroplong
JOURDAIN|héhé¶
```
- [ ] pgloader output you obtain
```
PASTE HERE THE OUTPUT OF THE PGLOADER COMMAND
```
- [ ] data that is being loaded, if relevant
```
PASTE HERE THE DATA THAT HAS BEEN LOADED
```
- [ ] How the data is different from what you expected, if relevant

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
pgloader
Copyright (c) 2005-2017, The PostgreSQL Global Development Group
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

View File

@ -1,17 +1,19 @@
# pgloader build tool
APP_NAME = pgloader
VERSION = 3.3.2
VERSION = 3.6.10
# use either sbcl or ccl
CL = sbcl
# default to 4096 MB of RAM size in the image
DYNSIZE = 4096
# default to 16 GB of RAM size in the image
DYNSIZE = 16384
LISP_SRC = $(wildcard src/*lisp) \
$(wildcard src/monkey/*lisp) \
$(wildcard src/utils/*lisp) \
$(wildcard src/load/*lisp) \
$(wildcard src/parsers/*lisp) \
$(wildcard src/pg-copy/*lisp) \
$(wildcard src/pgsql/*lisp) \
$(wildcard src/sources/*lisp) \
pgloader.asd
@ -21,9 +23,12 @@ LIBS = $(BUILDDIR)/libs.stamp
QLDIR = $(BUILDDIR)/quicklisp
MANIFEST = $(BUILDDIR)/manifest.ql
LATEST = $(BUILDDIR)/pgloader-latest.tgz
BUNDLEDIST = 2022-02-20
BUNDLENAME = pgloader-bundle-$(VERSION)
BUNDLEDIR = $(BUILDDIR)/bundle/$(BUNDLENAME)
BUNDLE = $(BUILDDIR)/$(BUNDLENAME).tgz
BUNDLETESTD= $(BUILDDIR)/bundle/test
ifeq ($(OS),Windows_NT)
EXE = .exe
@ -65,10 +70,9 @@ DEBUILD_ROOT = /tmp/pgloader
all: $(PGLOADER)
clean:
rm -rf $(LIBS) $(QLDIR) $(MANIFEST) $(BUILDAPP) $(PGLOADER)
docs:
ronn -roff pgloader.1.md
rm -rf $(LIBS) $(QLDIR) $(MANIFEST) $(BUILDAPP) $(PGLOADER) \
buildapp.log build/bundle/* build/pgloader-bundle* build/quicklisp.lisp docs/_build
$(MAKE) -C test clean
$(QLDIR)/local-projects/qmynd:
git clone --depth 1 https://github.com/qitab/qmynd.git $@
@ -97,10 +101,12 @@ clones: $(QLDIR)/local-projects/cl-ixf \
$(QLDIR)/local-projects/cl-csv \
$(QLDIR)/local-projects/qmynd ;
$(LIBS): $(QLDIR)/setup.lisp clones
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(push "$(PWD)/" asdf:*central-registry*)' \
--eval '(ql:quickload "pgloader")' \
$(LIBS): $(QLDIR)/setup.lisp
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(push :pgloader-image *features*)' \
--eval '(setf *print-circle* t *print-pretty* t)' \
--eval '(push "$(PWD)/" ql:*local-project-directories*)' \
--eval '(ql:quickload "pgloader")' \
--eval '(quit)'
touch $@
@ -139,8 +145,11 @@ $(PGLOADER): $(MANIFEST) $(BUILDAPP) $(LISP_SRC)
--manifest-file $(MANIFEST) \
--asdf-tree $(QLDIR)/dists \
--asdf-path . \
--load-system $(APP_NAME) \
--load-system cffi \
--load-system cl+ssl \
--load-system mssql \
--load src/hooks.lisp \
--load-system $(APP_NAME) \
--entry pgloader:main \
--dynamic-space-size $(DYNSIZE) \
$(COMPRESS_CORE_OPT) \
@ -160,19 +169,35 @@ pgloader-standalone:
$(COMPRESS_CORE_OPT) \
--output $(PGLOADER)
test: $(PGLOADER)
$(MAKE) PGLOADER=$(realpath $(PGLOADER)) -C test regress
$(MAKE) PGLOADER=$(realpath $(PGLOADER)) CL=$(CL) -C test regress
save: ./src/save.lisp $(LISP_SRC)
$(CL) $(CL_OPTS) --load ./src/save.lisp
check-saved:
$(MAKE) PGLOADER=$(realpath $(PGLOADER)) CL=$(CL) -C test regress
clean-bundle:
rm -rf $(BUNDLEDIR)
rm -rf $(BUNDLETESTD)/$(BUNDLENAME)/*
$(BUNDLEDIR):
$(BUNDLETESTD):
mkdir -p $@
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:bundle-systems (list "pgloader" "buildapp") :to "$@")' \
--eval '(quit)'
$(BUNDLE): $(BUNDLEDIR)
$(BUNDLEDIR): quicklisp
mkdir -p $@
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(defvar *bundle-dir* "$@")' \
--eval '(defvar *pwd* "$(PWD)/")' \
--eval '(defvar *ql-dist* "$(BUNDLEDIST)")' \
--load bundle/ql.lisp
$(BUNDLEDIR)/version.sexp: $(BUNDLEDIR)
echo "\"$(VERSION)\"" > $@
$(BUNDLE): $(BUNDLEDIR) $(BUNDLEDIR)/version.sexp
cp bundle/README.md $(BUNDLEDIR)
cp bundle/save.lisp $(BUNDLEDIR)
sed -e s/%VERSION%/$(VERSION)/ < bundle/Makefile > $(BUNDLEDIR)/Makefile
git archive --format=tar --prefix=pgloader-$(VERSION)/ master \
| tar -C $(BUNDLEDIR)/local-projects/ -xf -
@ -180,9 +205,12 @@ $(BUNDLE): $(BUNDLEDIR)
tar -C build/bundle \
--exclude bin \
--exclude test/sqlite \
-czf $@ pgloader-bundle-$(VERSION)
-czf $@ $(BUNDLENAME)
bundle: $(BUNDLE)
bundle: clean-bundle $(BUNDLE) $(BUNDLETESTD)
tar -C $(BUNDLETESTD) -xf $(BUNDLE)
make -C $(BUNDLETESTD)/$(BUNDLENAME)
$(BUNDLETESTD)/$(BUNDLENAME)/bin/pgloader --version
test-bundle:
$(MAKE) -C $(BUNDLEDIR) test
@ -193,11 +221,6 @@ deb:
mkdir -p $(DEBUILD_ROOT) && rm -rf $(DEBUILD_ROOT)/*
rsync -Ca --exclude 'build' \
--exclude '.vagrant' \
--exclude 'test/sqlite-chinook.load' \
--exclude 'test/sqlite' \
--exclude 'test/data/2013_Gaz_113CDs_national.txt' \
--exclude 'test/data/reg2013.dbf' \
--exclude 'test/data/sakila-db.zip' \
./ $(DEBUILD_ROOT)/
cd $(DEBUILD_ROOT) && make -f debian/rules orig
cd $(DEBUILD_ROOT) && debuild -us -uc -sa
@ -230,4 +253,4 @@ latest:
check: test ;
.PHONY: test pgloader-standalone
.PHONY: test pgloader-standalone docs bundle

161
README.md
View File

@ -1,8 +1,8 @@
# PGLoader
[![Build Status](https://travis-ci.org/dimitri/pgloader.svg?branch=master)](https://travis-ci.org/dimitri/pgloader)
[![Join the chat at https://gitter.im/dimitri/pgloader](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dimitri/pgloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Read The Docs Status](https://readthedocs.org/projects/pgloader/badge/?version=latest&style=plastic)](http://pgloader.readthedocs.io/en/latest/)
pgloader is a data loading tool for PostgreSQL, using the `COPY` command.
@ -20,113 +20,50 @@ 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*).
## Versioning
## Documentation
pgloader version 1.x is quite old and was developed in `TCL`.
When faced with maintaining that code, the new emerging development
team (hi!) picked `python` instead because that made sense at the
time. So pgloader version 2.x was written in python.
Full documentation is available online, including manual pages of all the
pgloader sub-commands. Check out
[https://pgloader.readthedocs.io/](https://pgloader.readthedocs.io/en/latest/).
The current version of pgloader is the 3.x series, which is written in
[Common Lisp](http://cliki.net/) for better development flexibility,
runtime performance, and support of real threading.
The versioning is now following the Emacs model, where any X.0 release
number means you're using a development version (alpha, beta, or release
candidate). The next stable versions are going to be `3.1` then `3.2` etc.
When using a development snapshot rather than a released version the version
number includes the git hash (in its abbreviated form):
- `pgloader version "3.0.99"`
Release candidate 9 for pgloader version 3.1, with a *git tag* named
`v3.0.99` so that it's easy to checkout the same sources as the
released code.
- `pgloader version "3.0.fecae2c"`
Development snapshot again *git hash* `fecae2c`. It's possible to have
the same sources on another setup with using the git command `git
checkout fecae2c`.
- `pgloader version "3.1.0"`
Stable release.
## LICENCE
pgloader is available under [The PostgreSQL Licence](http://www.postgresql.org/about/licence/).
## INSTALL
You can install pgloader directly from
[apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt) and from official
debian repositories, see
[packages.debian.org/pgloader](https://packages.debian.org/search?keywords=pgloader).
$ apt-get install pgloader
You can also use a **docker** image for pgloader at
<https://hub.docker.com/r/dimitri/pgloader/>:
$ docker pull dimitri/pgloader
$ docker run --rm --name pgloader dimitri/pgloader:latest pgloader --version
$ docker run --rm --name pgloader dimitri/pgloader:latest pgloader --help
## Build from sources
pgloader is now a Common Lisp program, tested using the
[SBCL](http://sbcl.org/) (>= 1.1.14) and
[Clozure CL](http://ccl.clozure.com/) implementations with
[Quicklisp](http://www.quicklisp.org/beta/).
$ apt-get install sbcl unzip libsqlite3-dev make curl gawk freetds-dev libzip-dev
$ cd /path/to/pgloader
$ make pgloader
$ ./build/bin/pgloader --help
When building from sources, you should always build from the current git
HEAD as it's basically the only source that is managed in a way to ensure it
builds aginst current set of dependencies versions.
## More options when building from source
The `Makefile` target `pgloader` knows how to produce a Self Contained
Binary file for pgloader, found at `./build/bin/pgloader`:
$ make pgloader
By default, the `Makefile` uses [SBCL](http://sbcl.org/) to compile your
binary image, though it's possible to build using
[CCL](http://ccl.clozure.com/).
$ make CL=ccl pgloader
If using `SBCL` and it supports core compression, the make process will
use it to generate a smaller binary. To force disabling core
compression, you may use:
$ make COMPRESS_CORE=no pgloader
The `--compress-core` is unique to SBCL, so not used when `CC` is different
from the `sbcl` value.
You can also tweak the default amount of memory that the `pgloader` image
will allow itself using when running through your data (don't ask for more
than your current RAM tho):
$ make DYNSIZE=8192 pgloader
The `make pgloader` command when successful outputs a `./build/bin/pgloader`
file for you to use.
```
$ 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](http://pgloader.io/howto/quickstart.html) on
<http://pgloader.io> for more details.
[pgloader quick start](https://pgloader.readthedocs.io/en/latest/tutorial/tutorial.html#pgloader-quick-start) on
<https://pgloader.readthedocs.io> for more details.
$ ./build/bin/pgloader --help
$ ./build/bin/pgloader <file.load>
@ -142,8 +79,22 @@ indexes, foreign keys, comments) and parallel loading of the corrected data:
$ createdb pagila
$ pgloader mysql://user@localhost/sakila postgresql:///pagila
See the documentation file `pgloader.1.md` for details. You can compile that
file into a manual page or an HTML page thanks to the `ronn` application:
## LICENCE
$ apt-get install ruby-ronn
$ make docs
pgloader is available under [The PostgreSQL
Licence](http://www.postgresql.org/about/licence/).
## INSTALL
Please see full documentation at
[https://pgloader.readthedocs.io/](https://pgloader.readthedocs.io/en/latest/install.html).
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

View File

@ -1,15 +1,17 @@
#!/usr/bin/env bash
SBCL_VERSION=2.2.5
sudo yum -y install yum-utils rpmdevtools @"Development Tools" \
sqlite-devel zlib-devel
# SBCL 1.3, we'll overwrite the repo version of sbcl with a more recent one
sudo yum -y install epel-release
sudo yum install -y sbcl.x86_64
sudo yum install -y sbcl.x86_64 --enablerepo=epel
wget http://downloads.sourceforge.net/project/sbcl/sbcl/1.3.6/sbcl-1.3.6-source.tar.bz2
tar xfj sbcl-1.3.6-source.tar.bz2
cd sbcl-1.3.6
wget http://downloads.sourceforge.net/project/sbcl/sbcl/$SBCL_VERSION/sbcl-$SBCL_VERSION-source.tar.bz2
tar xfj sbcl-$SBCL_VERSION-source.tar.bz2
cd sbcl-$SBCL_VERSION
./make.sh --with-sb-thread --with-sb-core-compression --prefix=/usr > /dev/null 2>&1
sudo sh install.sh
cd

View File

@ -27,8 +27,8 @@ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirrors.linsrv.net/mariadb/repo/10.0/debian wheezy main'
sudo apt-get update
sudo apt-get install -y postgresql-9.3 postgresql-contrib-9.3 \
postgresql-9.3-ip4r \
sudo apt-get install -y postgresql-15 \
postgresql-15-ip4r \
sbcl \
git patch unzip \
devscripts pandoc \

View File

@ -10,7 +10,7 @@ EXE = .exe
COMPRESS_CORE = no
DYNSIZE = 1024 # support for windows 32 bits
else
DYNSIZE = 4096
DYNSIZE = 16384
EXE =
endif
@ -48,9 +48,12 @@ $(PGLOADER): $(BUILDAPP)
$(BUILDAPP_OPTS) \
--sbcl $(CL) \
--asdf-tree . \
--load-system cffi \
--load-system cl+ssl \
--load-system mssql \
--load $(SRCDIR)/src/hooks.lisp \
--load-system $(APP_NAME) \
--eval '(setf pgloader.params::*version-string* "$(VERSION)")' \
--load $(SRCDIR)/src/hooks.lisp \
--entry pgloader:main \
--dynamic-space-size $(DYNSIZE) \
$(COMPRESS_CORE_OPT) \
@ -61,4 +64,7 @@ $(PGLOADER): $(BUILDAPP)
test: $(PGLOADER)
$(MAKE) PGLOADER=$(realpath $(PGLOADER)) -C $(SRCDIR)/test regress
save:
sbcl --no-userinit --load ./save.lisp
check: test ;

30
bundle/ql.lisp Normal file
View File

@ -0,0 +1,30 @@
;;;
;;; Script used to prepare a pgloader bundle
;;;
;; fetch a list of recent candidates with
;; (subseq (ql-dist:available-versions (ql-dist:dist "quicklisp")) 0 5)
;;
;; the 2017-06-30 QL release is broken, avoid it.
;;
(defvar *ql-dist* :latest)
(defvar *ql-dist-url-format*
"http://beta.quicklisp.org/dist/quicklisp/~a/distinfo.txt")
(let ((pkgs (append '("pgloader" "buildapp")
(getf (read-from-string
(uiop:read-file-string
(uiop:merge-pathnames* "pgloader.asd" *pwd*)))
:depends-on)))
(dist (if (or (eq :latest *ql-dist*)
(string= "latest" *ql-dist*))
(cdr
;; available-versions is an alist of (date . url), and the
;; first one is the most recent one
(first
(ql-dist:available-versions (ql-dist:dist "quicklisp"))))
(format nil *ql-dist-url-format* *ql-dist*))))
(ql-dist:install-dist dist :prompt nil :replace t)
(ql:bundle-systems pkgs :to *bundle-dir*))
(quit)

47
bundle/save.lisp Normal file
View File

@ -0,0 +1,47 @@
;;;
;;; Create a build/bin/pgloader executable from the source code, using
;;; Quicklisp to load pgloader and its dependencies.
;;;
(in-package #:cl-user)
(require :asdf) ; should work in SBCL and CCL
(let* ((cwd (uiop:getcwd))
(bundle.lisp (uiop:merge-pathnames* "bundle.lisp" cwd))
(version-file (uiop:merge-pathnames* "version.sexp" cwd))
(version-string (uiop:read-file-form version-file))
(asdf:*central-registry* (list cwd)))
(format t "Loading bundle.lisp~%")
(load bundle.lisp)
(format t "Loading system pgloader ~a~%" version-string)
(asdf:load-system :pgloader :verbose nil)
(load (asdf:system-relative-pathname :pgloader "src/hooks.lisp"))
(let* ((pgl (find-package "PGLOADER"))
(version-symbol (find-symbol "*VERSION-STRING*" pgl)))
(setf (symbol-value version-symbol) version-string)))
(defun pgloader-image-main ()
(let ((argv #+sbcl sb-ext:*posix-argv*
#+ccl ccl:*command-line-argument-list*))
(pgloader::main argv)))
(let* ((cwd (uiop:getcwd))
(bin-dir (uiop:merge-pathnames* "bin/" cwd))
(bin-filename (uiop:merge-pathnames* "pgloader" bin-dir)))
(ensure-directories-exist bin-dir)
#+ccl
(ccl:save-application bin-filename
:toplevel-function #'cl-user::pgloader-image-main
:prepend-kernel t)
#+sbcl
(sb-ext:save-lisp-and-die bin-filename
:toplevel #'cl-user::pgloader-image-main
:executable t
:save-runtime-options t
:compression t))

4
conf/freetds.conf Normal file
View File

@ -0,0 +1,4 @@
[global]
tds version = 8.0
client charset = UTF-8

122
debian/changelog vendored
View File

@ -1,3 +1,125 @@
pgloader (3.6.10-2) unstable; urgency=medium
* Limit architectures to those that have sbcl available and working thread
support (notably, this excludes armel and armhf).
-- Christoph Berg <myon@debian.org> Fri, 22 Mar 2024 14:59:27 +0100
pgloader (3.6.10-1) unstable; urgency=medium
* New upstream version.
* Bump ip4r dependencies to 16. (Closes: #1052837)
-- Christoph Berg <myon@debian.org> Thu, 02 Nov 2023 17:44:07 +0100
pgloader (3.6.9-1) unstable; urgency=medium
* New upstream version.
* Bump ip4r dependencies to 15. (Closes: #1022296)
-- Christoph Berg <myon@debian.org> Mon, 24 Oct 2022 12:58:09 +0200
pgloader (3.6.8-1) unstable; urgency=medium
* New upstream version.
* Depend on libsqlite3-0.
-- Christoph Berg <myon@debian.org> Mon, 26 Sep 2022 14:24:02 +0200
pgloader (3.6.7-1) unstable; urgency=medium
* New upstream version:
* Set SBCL dynamic space size to 16 GB on 64 bit architectures.
* Improve documentation with command lines and defaults.
* SBCL compiler notes should not be fatal to pgloader.
-- Christoph Berg <myon@debian.org> Sat, 13 Aug 2022 10:32:41 +0200
pgloader (3.6.6-1) unstable; urgency=medium
* New upstream version.
* Run tests at build-time as well.
-- Christoph Berg <myon@debian.org> Mon, 27 Jun 2022 11:03:00 +0200
pgloader (3.6.4-1) unstable; urgency=medium
* New upstream version.
* debian/tests/testsuite: Run regression tests.
-- Christoph Berg <myon@debian.org> Fri, 24 Jun 2022 14:32:54 +0200
pgloader (3.6.3-1) unstable; urgency=medium
* New upstream version.
* Remove cl-pgloader, deprecated upstream.
* debian/tests/ssl: Force md5 auth if cl-postmodern is too old.
-- Christoph Berg <myon@debian.org> Tue, 21 Dec 2021 10:09:53 +0100
pgloader (3.6.2-1) unstable; urgency=medium
* New upstream version.
* debian/tests/ssl: Add --debug to get backtraces.
* debian/rules: Sync loaded systems with Makefile.
* debian/rules: Print actual compiler log.
* debian/rules: Skip dh_dwz like dh_strip as it fails on buster.
* Bump required cl-db3 version to 20200212.
* Note that we need cl-plus-ssl 20190204 or later.
* Note that we need cl-csv 20180712 or later.
* DH 13.
-- Christoph Berg <myon@debian.org> Tue, 14 Jul 2020 17:02:30 +0200
pgloader (3.6.1-1) unstable; urgency=medium
* New upstream version.
* SSL is always enabled now, drop our patch.
* Add B-D on python3-sphinx-rtd-theme.
-- Christoph Berg <christoph.berg@credativ.de> Mon, 21 Jan 2019 16:09:17 +0100
pgloader (3.5.2-3) unstable; urgency=medium
* Make cl-pgloader test depend on ca-certificates so the snakeoil
certificate is recognized as a valid CA. (Needs the /etc/ssl/certs/*.0
file.)
-- Christoph Berg <christoph.berg@credativ.de> Tue, 31 Jul 2018 16:24:03 +0200
pgloader (3.5.2-2) unstable; urgency=medium
* Install pgloader.asd into correct location. (Closes: #857226)
* Test cl-pgloader through sbcl --eval.
* Skip building and manpage generation in arch-indep builds.
-- Christoph Berg <myon@debian.org> Tue, 03 Jul 2018 22:51:48 +0200
pgloader (3.5.2-1) unstable; urgency=medium
* New upstream version.
* All included test data has been verified as free, stop building a +dfsg
tarball.
* debian/source/options: Ignore changes in src/params.lisp (release vs
non-release).
* Enable SSL in src/hooks.lisp.
* Run wrap-and-sort -st.
* Add new B-D cl-mustache, cl-yason, cl-zs3, sync Depends to cl-pgloader.
* Depend on the libssl version cl-plus-ssl depends on. (Closes: #864309)
* Build and install new sphinx docs instead.
* Build manpage using help2man.
* Priority: optional, move cl-pgloader to Section: lisp.
* Update S-V.
* Add watch file.
-- Christoph Berg <christoph.berg@credativ.de> Tue, 03 Jul 2018 16:59:07 +0200
pgloader (3.4.1+dfsg-1) unstable; urgency=medium
* New release, bugfixes and new features
-- Dimitri Fontaine <dim@tapoueh.org> Thu, 06 Jul 2017 16:51:53 +0300
pgloader (3.3.2+dfsg-1) unstable; urgency=medium
* Fixes github issue 453 (Closes: #843555)

View File

@ -1,2 +0,0 @@
usr/share/common-lisp/source/pgloader
usr/share/common-lisp/systems

View File

@ -1,2 +0,0 @@
README.md
pgloader.1.md

View File

@ -1,3 +0,0 @@
pgloader.asd usr/share/common-lisp/source/simple-date
pgloader.lisp usr/share/common-lisp/source/pgloader
src usr/share/common-lisp/source/pgloader

View File

@ -1 +0,0 @@
usr/share/common-lisp/source/pgloader/pgloader.asd usr/share/common-lisp/systems/pgloader.asd

1
debian/clean vendored Normal file
View File

@ -0,0 +1 @@
buildapp.*

1
debian/compat vendored
View File

@ -1 +0,0 @@
8

86
debian/control vendored
View File

@ -1,34 +1,74 @@
Source: pgloader
Section: database
Priority: extra
Priority: optional
Maintainer: Dimitri Fontaine <dim@tapoueh.org>
Uploaders: Christoph Berg <myon@debian.org>
Build-Depends: debhelper (>= 8.0.0), sbcl (>= 1.1.13), ruby-ronn, buildapp (>= 1.5), cl-asdf (>= 3.0.3), cl-log, cl-postmodern, cl-simple-date, cl-qmynd, cl-split-sequence, cl-unicode, cl-interpol, cl-csv, cl-fad, cl-lparallel, cl-esrap, cl-alexandria, cl-drakma, cl-flexi-streams, cl-usocket, cl-local-time, cl-command-line-arguments, cl-abnf, cl-db3, cl-py-configparser, cl-sqlite, cl-trivial-backtrace, cl-markdown, cl-md5, cl-asdf-finalizers, cl-asdf-system-connections, cl-cffi (>= 1:0.12.0), cl-ixf, gawk, cl-bordeaux-threads (>= 0.8.3), cl-metabang-bind, cl-mssql, cl-uuid, cl-trivial-utf-8, cl-quri, cl-utilities, cl-ppcre, tzdata
Standards-Version: 3.9.6
Uploaders:
Christoph Berg <myon@debian.org>,
Build-Depends:
buildapp (>= 1.5),
cl-abnf,
cl-alexandria,
cl-asdf (>= 3.0.3),
cl-asdf-finalizers,
cl-asdf-system-connections,
cl-bordeaux-threads (>= 0.8.3),
cl-cffi (>= 1:0.12.0),
cl-command-line-arguments,
cl-csv (>= 20180712),
cl-db3 (>= 20200212),
cl-drakma,
cl-esrap,
cl-fad,
cl-flexi-streams,
cl-interpol,
cl-ixf,
cl-local-time,
cl-log,
cl-lparallel,
cl-markdown,
cl-md5,
cl-metabang-bind,
cl-mssql,
cl-mustache,
cl-plus-ssl (>= 20190204),
cl-postmodern,
cl-ppcre,
cl-py-configparser,
cl-qmynd,
cl-quri,
cl-simple-date,
cl-split-sequence,
cl-sqlite,
cl-trivial-backtrace,
cl-trivial-utf-8,
cl-unicode,
cl-usocket,
cl-utilities,
cl-uuid,
cl-yason,
cl-zs3,
debhelper-compat (= 13),
gawk,
help2man,
libsqlite3-dev,
postgresql-16-ip4r <!nocheck> | postgresql-ip4r <!nocheck>,
python3-sphinx,
python3-sphinx-rtd-theme,
sbcl (>= 1.1.13),
tzdata,
Standards-Version: 4.6.0
Homepage: https://github.com/dimitri/pgloader
Vcs-Git: https://github.com/dimitri/pgloader.git
Vcs-Browser: https://github.com/dimitri/pgloader
Package: pgloader
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freetds-dev
Description: extract, transform and load data into PostgreSQL
pgloader imports data from different kind of sources and COPY it into
PostgreSQL.
.
The command language is described in the manual page and allows one to
describe where to find the data source, its format, and to describe data
processing and transformation.
.
Supported source formats include CSV, fixed width flat files, dBase3 files
(DBF), and SQLite and MySQL databases. In most of those formats, pgloader
is able to auto-discover the schema and create the tables and the indexes
in PostgreSQL. In the MySQL case it's possible to edit CASTing rules from
the pgloader command directly.
Package: cl-pgloader
Architecture: all
Depends: ${misc:Depends}, cl-asdf (>= 3.0.3), cl-log, cl-postmodern, cl-simple-date, cl-qmynd, cl-split-sequence, cl-unicode, cl-interpol, cl-csv, cl-fad, cl-lparallel, cl-esrap, cl-alexandria, cl-drakma, cl-flexi-streams, cl-usocket, cl-local-time, cl-command-line-arguments, cl-abnf, cl-db3, cl-py-configparser, cl-sqlite, cl-trivial-backtrace, cl-markdown, cl-md5, cl-asdf-finalizers, cl-asdf-system-connections, cl-cffi (>= 1:0.12.0), cl-bordeaux-threads (>= 0.8.3), cl-metabang-bind, cl-uuid, cl-trivial-utf-8, cl-quri, cl-utilities, cl-ppcre
Architecture: amd64 arm64 i386 ppc64el powerpc ppc64
Depends:
freetds-dev,
${misc:Depends},
${shlibs:Depends},
${sqlite:Depends},
${ssl:Depends},
Description: extract, transform and load data into PostgreSQL
pgloader imports data from different kind of sources and COPY it into
PostgreSQL.

74
debian/copyright vendored
View File

@ -20,4 +20,76 @@ License: PostgreSQL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Files: test/sqlite/Chinook*
Copyright: Copyright (c) 2008-2017 Luis Rocha
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS
IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Files: test/data/2013_Gaz_113CDs_national.txt
Copyright: public domain
License: us-public-domain
All U.S. Census Bureau materials, regardless of the media, are entirely in the
public domain. There are no user fees, site licenses, or any special agreements
etc for the public or private use, and or reuse of any census title. As tax
funded product, it's all in the public record.
Files: test/data/reg2013.dbf
Copyright: public comain
License: fr-public-domain
Les publications et données mises à disposition sur le présent site sont
consultables et téléchargeables gratuitement. Sauf spécification contraire,
elles peuvent être réutilisées, y compris à des fins commerciales, sans licence
et sans versement de redevances autres que celles collectées par les sociétés
de perception et de répartition des droits d'auteur régies par le titre II du
livre III du code de la propriété intellectuelle. La réutilisation est
toutefois subordonnée au respect de l'intégrité de l'information et des données
et à la mention précise des sources.
.
https://www.insee.fr/fr/information/2008466
Files: test/data/sakila-db.zip
Copyright: Copyright © 2007, 2018, Oracle and/or its affiliates. All rights reserved.
License: new-bsd-license
The contents of the sakila-schema.sql and sakila-data.sql files are licensed
under the New BSD license.
.
Information on the New BSD license can be found at
http://www.opensource.org/licenses/bsd-license.php and
http://en.wikipedia.org/wiki/BSD_License.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

14
debian/patches/bionic-theme-options vendored Normal file
View File

@ -0,0 +1,14 @@
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -92,11 +92,6 @@ html_theme = 'sphinx_rtd_theme'
#
# html_theme_options = {}
html_theme_options = {
- 'github_user': 'dimitri',
- 'github_repo': 'pgloader',
- 'description': 'your migration companion',
- 'travis_button': True,
- 'show_related': True,
#'sidebar_collapse': False,
}

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
#bionic-theme-options

View File

@ -1,3 +1,2 @@
README.md
pgloader.1.md
web/src/*.md
docs/_build/html

View File

@ -1 +0,0 @@
pgloader.1

106
debian/rules vendored
View File

@ -1,55 +1,87 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
PKGVERS = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
EXCLUDE = --exclude-vcs --exclude=debian --exclude=build --exclude=.vagrant
# get libsqlite3 package name from libsqlite3-dev
LIBSQLITE := $(shell dpkg-query --showformat='$${Depends}' --show libsqlite3-dev | grep -o 'libsqlite[^ ]*')
# make pgloader depend on the libssl package cl-plus-ssl depends on
LIBSSL := $(shell dpkg-query --showformat='$${Depends}' --show cl-plus-ssl | grep -o 'libssl[^ ]*')
BITS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
ifeq ($(BITS),32)
SIZE=1024
else
SIZE=4096
SIZE=16384
endif
MAKEFILE_VERSION = $(shell awk '/^VERSION/ { print $$3 }' Makefile)
DOC_VERSION = $(shell awk '/^release/ { print $$3 }' docs/conf.py | tr -d "'")
SPECFILE_VERSION = $(shell awk '/^Version/ { print $$2 }' pgloader.spec)
DEBIAN_VERSION = $(shell dpkg-parsechangelog -SVersion | cut -d- -f 1)
PGLOADER_MAJOR_VERSION = $(shell awk '/^.defparameter .major-version/ { print $$3 }' src/params.lisp | grep -Eo '[0-9.]+')
PGLOADER_MINOR_VERSION = $(shell awk '/^.defparameter .minor-version/ { print $$3 }' src/params.lisp | grep -Eo '[0-9.]+')
# buildd provides a build environment where $HOME is not writable, but the
# CL compilers here will need to fill-in a per-user cache
export HOME = $(CURDIR)/debian/home
orig: clean
rm -rf $(HOME)
cd .. && tar czf pgloader_$(PKGVERS).orig.tar.gz $(EXCLUDE) pgloader
override_dh_auto_clean:
dh_auto_clean
rm -rf debian/home
# sanity checks on version number
[ "$(MAKEFILE_VERSION)" = "$(DOC_VERSION)" ] # Makefile = docs/conf.py version
[ "$(MAKEFILE_VERSION)" = "$(SPECFILE_VERSION)" ] # Makefile = pgloader.spec version
[ "$(MAKEFILE_VERSION)" = "$(DEBIAN_VERSION)" ] # Makefile = debian/changelog version
[ "$(MAKEFILE_VERSION)" = "$(PGLOADER_MAJOR_VERSION).$(PGLOADER_MINOR_VERSION)" ] # Makefile = src/params.lisp version
override_dh_auto_build:
make docs
mkdir -p build/bin
mkdir -p $(HOME)
buildapp --require sb-posix \
--require sb-bsd-sockets \
--load /usr/share/common-lisp/source/cl-asdf/build/asdf.lisp \
--asdf-path . \
--asdf-tree /usr/share/common-lisp/systems \
--load-system asdf-finalizers \
--load-system asdf-system-connections \
--load-system pgloader \
--load src/hooks.lisp \
--entry pgloader:main \
--dynamic-space-size $(SIZE) \
--compress-core \
--output build/bin/pgloader
override_dh_auto_test:
# no nothing
override_dh_strip:
override_dh_auto_build-indep:
# do nothing
override_dh_auto_build-arch:
mkdir -p build/bin
mkdir -p $(HOME)
buildapp --require sb-posix \
--require sb-bsd-sockets \
--load /usr/share/common-lisp/source/cl-asdf/build/asdf.lisp \
--asdf-path . \
--asdf-tree /usr/share/common-lisp/systems \
--load-system asdf-finalizers \
--load-system asdf-system-connections \
--load-system cffi \
--load-system cl+ssl \
--load-system mssql \
--load src/hooks.lisp \
--load-system pgloader \
--entry pgloader:main \
--dynamic-space-size $(SIZE) \
--compress-core \
--logfile buildapp.log \
--output build/bin/pgloader \
|| echo $$? > buildapp.fail
cat buildapp.log
test ! -f buildapp.fail
ls -l build/bin/pgloader
$(MAKE) -C docs html
override_dh_auto_test:
PATH=$(CURDIR)/build/bin:$(PATH) debian/tests/testsuite
override_dh_strip override_dh_dwz:
# do nothing, sbcl doesn't write any debug info
override_dh_installman-arch:
mkdir -p debian/pgloader/usr/share/man/man1/
PATH=debian/pgloader/usr/bin:$(PATH) \
help2man --version-string $(DEB_VERSION_UPSTREAM) \
--no-info \
--name "extract, transform and load data into PostgreSQL" \
pgloader > \
debian/pgloader/usr/share/man/man1/pgloader.1
override_dh_gencontrol:
dh_gencontrol -- \
-V"sqlite:Depends=$(LIBSQLITE)" \
-V"ssl:Depends=$(LIBSSL)"
%:
dh $@
dh $@

2
debian/source/options vendored Normal file
View File

@ -0,0 +1,2 @@
# ignore release/non-release status
extend-diff-ignore=src/params.lisp

13
debian/tests/control vendored Normal file
View File

@ -0,0 +1,13 @@
Depends:
ca-certificates,
cl-postmodern,
pgloader,
postgresql,
Tests: ssl
Restrictions: allow-stderr, needs-root
Depends:
pgloader,
postgresql-16-ip4r | postgresql-ip4r,
Tests: testsuite
Restrictions: allow-stderr

34
debian/tests/ssl vendored Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# test needs root so we have a SSL certificate
set -eux
trap "rm -rf /tmp/pgloader" EXIT
# check if cl-postmodern is new enough to support scram-sha-256
postmodern=$(dpkg-query --show --showformat='${Version}' cl-postmodern)
if dpkg --compare-versions "$postmodern" lt 20200101; then
AUTH="-i--auth-local=trust -i--auth-host=md5"
fi
pg_virtualenv ${AUTH:-} <<-'EOF'
set -eux
# force SSL connection
HBA=$(psql -XAtc 'SHOW hba_file')
sed -i -e 's/^host/hostssl/' $HBA
psql -XAtc 'SELECT pg_reload_conf()'
createdb pgloader
export PGDATABASE=pgloader
psql -XAtc 'create schema expected'
# test UNIX socket
rm -rf /tmp/pgloader
PGHOST=/var/run/postgresql su -c 'pgloader --debug --regress test/allcols.load' postgres
# test SSL connection
rm -rf /tmp/pgloader
PGSSLMODE=require pgloader --debug --regress test/allcols.load
EOF

11
debian/tests/testsuite vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -eux
case $USER in
root) PGSUPERUSER=postgres ;;
*) PGSUPERUSER=$USER ;;
esac
# use trust authentication to avoid scram failures on bullseye/buster/stretch/impish/focal/bionic
PGLOADER=pgloader PGSUPERUSER=$PGSUPERUSER pg_virtualenv -i'-Atrust' make -C test prepare regress

2
debian/watch vendored Normal file
View File

@ -0,0 +1,2 @@
version=4
https://github.com/dimitri/pgloader/tags .*/v(.*).tar.gz

1
docs/CNAME Normal file
View File

@ -0,0 +1 @@
pgloader.org

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = pgloader
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

123
docs/batches.rst Normal file
View File

@ -0,0 +1,123 @@
Batch Processing
================
To load data to PostgreSQL, pgloader uses the `COPY` streaming protocol.
While this is the faster way to load data, `COPY` has an important drawback:
as soon as PostgreSQL emits an error with any bit of data sent to it,
whatever the problem is, the whole data set is rejected by PostgreSQL.
To work around that, pgloader cuts the data into *batches* of 25000 rows
each, so that when a problem occurs it's only impacting that many rows of
data. Each batch is kept in memory while the `COPY` streaming happens, in
order to be able to handle errors should some happen.
When PostgreSQL rejects the whole batch, pgloader logs the error message
then isolates the bad row(s) from the accepted ones by retrying the batched
rows in smaller batches. To do that, pgloader parses the *CONTEXT* error
message from the failed COPY, as the message contains the line number where
the error was found in the batch, as in the following example::
CONTEXT: COPY errors, line 3, column b: "2006-13-11"
Using that information, pgloader will reload all rows in the batch before
the erroneous one, log the erroneous one as rejected, then try loading the
remaining of the batch in a single attempt, which may or may not contain
other erroneous data.
At the end of a load containing rejected rows, you will find two files in
the *root-dir* location, under a directory named the same as the target
database of your setup. The filenames are the target table, and their
extensions are `.dat` for the rejected data and `.log` for the file
containing the full PostgreSQL client side logs about the rejected data.
The `.dat` file is formatted in PostgreSQL the text COPY format as documented
in `http://www.postgresql.org/docs/9.2/static/sql-copy.html#AEN66609`.
It is possible to use the following WITH options to control pgloader batch
behavior:
- *on error stop*, *on error resume next*
This option controls if pgloader is using building batches of data at
all. The batch implementation allows pgloader to recover errors by
sending the data that PostgreSQL accepts again, and by keeping away the
data that PostgreSQL rejects.
To enable retrying the data and loading the good parts, use the option
*on error resume next*, which is the default to file based data loads
(such as CSV, IXF or DBF).
When migrating from another RDMBS technology, it's best to have a
reproducible loading process. In that case it's possible to use *on
error stop* and fix either the casting rules, the data transformation
functions or in cases the input data until your migration runs through
completion. That's why *on error resume next* is the default for SQLite,
MySQL and MS SQL source kinds.
A Note About Performance
------------------------
pgloader has been developed with performance in mind, to be able to cope
with ever growing needs in loading large amounts of data into PostgreSQL.
The basic architecture it uses is the old Unix pipe model, where a thread is
responsible for loading the data (reading a CSV file, querying MySQL, etc)
and fills pre-processed data into a queue. Another threads feeds from the
queue, apply some more *transformations* to the input data and stream the
end result to PostgreSQL using the COPY protocol.
When given a file that the PostgreSQL `COPY` command knows how to parse, and
if the file contains no erroneous data, then pgloader will never be as fast
as just using the PostgreSQL `COPY` command.
Note that while the `COPY` command is restricted to read either from its
standard input or from a local file on the server's file system, the command
line tool `psql` implements a `\copy` command that knows how to stream a
file local to the client over the network and into the PostgreSQL server,
using the same protocol as pgloader uses.
A Note About Parallelism
------------------------
pgloader uses several concurrent tasks to process the data being loaded:
- a reader task reads the data in and pushes it to a queue,
- at last one write task feeds from the queue and formats the raw into the
PostgreSQL COPY format in batches (so that it's possible to then retry a
failed batch without reading the data from source again), and then sends
the data to PostgreSQL using the COPY protocol.
The parameter *workers* allows to control how many worker threads are
allowed to be active at any time (that's the parallelism level); and the
parameter *concurrency* allows to control how many tasks are started to
handle the data (they may not all run at the same time, depending on the
*workers* setting).
We allow *workers* simultaneous workers to be active at the same time in the
context of a single table. A single unit of work consist of several kinds of
workers:
- a reader getting raw data from the source,
- N writers preparing and sending the data down to PostgreSQL.
The N here is setup to the *concurrency* parameter: with a *CONCURRENCY* of
2, we start (+ 1 2) = 3 concurrent tasks, with a *concurrency* of 4 we start
(+ 1 4) = 5 concurrent tasks, of which only *workers* may be active
simultaneously.
The defaults are `workers = 4, concurrency = 1` when loading from a database
source, and `workers = 8, concurrency = 2` when loading from something else
(currently, a file). Those defaults are arbitrary and waiting for feedback
from users, so please consider providing feedback if you play with the
settings.
As the `CREATE INDEX` threads started by pgloader are only waiting until
PostgreSQL is done with the real work, those threads are *NOT* counted into
the concurrency levels as detailed here.
By default, as many `CREATE INDEX` threads as the maximum number of indexes
per table are found in your source schema. It is possible to set the `max
parallel create index` *WITH* option to another number in case there's just
too many of them to create.

49
docs/bugreport.rst Normal file
View File

@ -0,0 +1,49 @@
Reporting Bugs
==============
pgloader is a software and as such contains bugs. Most bugs are easy to
solve and taken care of in a short delay. For this to be possible though,
bug reports need to follow those recommandations:
- include pgloader version,
- include problematic input and output,
- include a description of the output you expected,
- explain the difference between the ouput you have and the one you expected,
- include a self-reproducing test-case
Test Cases to Reproduce Bugs
----------------------------
Use the *inline* source type to help reproduce a bug, as in the pgloader tests::
LOAD CSV
FROM INLINE
INTO postgresql://dim@localhost/pgloader?public."HS"
WITH truncate,
fields terminated by '\t',
fields not enclosed,
fields escaped by backslash-quote,
quote identifiers
SET work_mem to '128MB',
standard_conforming_strings to 'on',
application_name to 'my app name'
BEFORE LOAD DO
$$ create extension if not exists hstore; $$,
$$ drop table if exists "HS"; $$,
$$ CREATE TABLE "HS"
(
id serial primary key,
kv hstore
)
$$;
1 email=>foo@example.com,a=>b
2 test=>value
3 a=>b,c=>"quoted hstore value",d=>other
4 baddata

380
docs/command.rst Normal file
View File

@ -0,0 +1,380 @@
Command Syntax
==============
pgloader implements a Domain Specific Language allowing to setup complex
data loading scripts handling computed columns and on-the-fly sanitization
of the input data. For more complex data loading scenarios, you will be
required to learn that DSL's syntax. It's meant to look familiar to DBA by
being inspired by SQL where it makes sense, which is not that much after
all.
The pgloader commands follow the same global grammar rules. Each of them
might support only a subset of the general options and provide specific
options.
::
LOAD <source-type>
FROM <source-url>
[ HAVING FIELDS <source-level-options> ]
INTO <postgresql-url>
[ TARGET TABLE [ "<schema>" ]."<table name>" ]
[ TARGET COLUMNS <columns-and-options> ]
[ WITH <load-options> ]
[ SET <postgresql-settings> ]
[ BEFORE LOAD [ DO <sql statements> | EXECUTE <sql file> ] ... ]
[ AFTER LOAD [ DO <sql statements> | EXECUTE <sql file> ] ... ]
;
The main clauses are the `LOAD`, `FROM`, `INTO` and `WITH` clauses that each
command implements. Some command then implement the `SET` command, or some
specific clauses such as the `CAST` clause.
.. _common_clauses:
Command Clauses
---------------
The pgloader command syntax allows composing CLAUSEs together. Some clauses
are specific to the FROM source-type, most clauses are always available.
FROM
----
The *FROM* clause specifies where to read the data from, and each command
introduces its own variant of sources. For instance, the *CSV* source
supports `inline`, `stdin`, a filename, a quoted filename, and a *FILENAME
MATCHING* clause (see above); whereas the *MySQL* source only supports a
MySQL database URI specification.
INTO
----
The PostgreSQL connection URI must contains the name of the target table
where to load the data into. That table must have already been created in
PostgreSQL, and the name might be schema qualified.
Then *INTO* option also supports an optional comma separated list of target
columns, which are either the name of an input *field* or the white space
separated list of the target column name, its PostgreSQL data type and a
*USING* expression.
The *USING* expression can be any valid Common Lisp form and will be read
with the current package set to `pgloader.transforms`, so that you can use
functions defined in that package, such as functions loaded dynamically with
the `--load` command line parameter.
Each *USING* expression is compiled at runtime to native code.
This feature allows pgloader to load any number of fields in a CSV file into
a possibly different number of columns in the database, using custom code
for that projection.
WITH
----
Set of options to apply to the command, using a global syntax of either:
- *key = value*
- *use option*
- *do not use option*
See each specific command for details.
All data sources specific commands support the following options:
- *on error stop*, *on error resume next*
- *batch rows = R*
- *batch size = ... MB*
- *prefetch rows = ...*
See the section BATCH BEHAVIOUR OPTIONS for more details.
In addition, the following settings are available:
- *workers = W*
- *concurrency = C*
- *max parallel create index = I*
See section A NOTE ABOUT PARALLELISM for more details.
SET
---
This clause allows to specify session parameters to be set for all the
sessions opened by pgloader. It expects a list of parameter name, the equal
sign, then the single-quoted value as a comma separated list.
The names and values of the parameters are not validated by pgloader, they
are given as-is to PostgreSQL.
BEFORE LOAD DO
--------------
You can run SQL queries against the database before loading the data from
the `CSV` file. Most common SQL queries are `CREATE TABLE IF NOT EXISTS` so
that the data can be loaded.
Each command must be *dollar-quoted*: it must begin and end with a double
dollar sign, `$$`. Dollar-quoted queries are then comma separated. No extra
punctuation is expected after the last SQL query.
BEFORE LOAD EXECUTE
-------------------
Same behaviour as in the *BEFORE LOAD DO* clause. Allows you to read the SQL
queries from a SQL file. Implements support for PostgreSQL dollar-quoting
and the `\i` and `\ir` include facilities as in `psql` batch mode (where
they are the same thing).
AFTER LOAD DO
-------------
Same format as *BEFORE LOAD DO*, the dollar-quoted queries found in that
section are executed once the load is done. That's the right time to create
indexes and constraints, or re-enable triggers.
AFTER LOAD EXECUTE
------------------
Same behaviour as in the *AFTER LOAD DO* clause. Allows you to read the SQL
queries from a SQL file. Implements support for PostgreSQL dollar-quoting
and the `\i` and `\ir` include facilities as in `psql` batch mode (where
they are the same thing).
AFTER CREATE SCHEMA DO
----------------------
Same format as *BEFORE LOAD DO*, the dollar-quoted queries found in that
section are executed once the schema has been created by pgloader, and
before the data is loaded. It's the right time to ALTER TABLE or do some
custom implementation on-top of what pgloader does, like maybe partitioning.
AFTER CREATE SCHEMA EXECUTE
---------------------------
Same behaviour as in the *AFTER CREATE SCHEMA DO* clause. Allows you to read
the SQL queries from a SQL file. Implements support for PostgreSQL
dollar-quoting and the `\i` and `\ir` include facilities as in `psql` batch
mode (where they are the same thing).
Connection String
-----------------
The `<postgresql-url>` parameter is expected to be given as a *Connection URI*
as documented in the PostgreSQL documentation at
http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING.
::
postgresql://[user[:password]@][netloc][:port][/dbname][?option=value&...]
Where:
- *user*
Can contain any character, including colon (`:`) which must then be
doubled (`::`) and at-sign (`@`) which must then be doubled (`@@`).
When omitted, the *user* name defaults to the value of the `PGUSER`
environment variable, and if it is unset, the value of the `USER`
environment variable.
- *password*
Can contain any character, including the at sign (`@`) which must then
be doubled (`@@`). To leave the password empty, when the *user* name
ends with at at sign, you then have to use the syntax user:@.
When omitted, the *password* defaults to the value of the `PGPASSWORD`
environment variable if it is set, otherwise the password is left
unset.
When no *password* is found either in the connection URI nor in the
environment, then pgloader looks for a `.pgpass` file as documented at
https://www.postgresql.org/docs/current/static/libpq-pgpass.html. The
implementation is not that of `libpq` though. As with `libpq` you can
set the environment variable `PGPASSFILE` to point to a `.pgpass` file,
and pgloader defaults to `~/.pgpass` on unix like systems and
`%APPDATA%\postgresql\pgpass.conf` on windows. Matching rules and syntax
are the same as with `libpq`, refer to its documentation.
- *netloc*
Can be either a hostname in dotted notation, or an ipv4, or an Unix
domain socket path. Empty is the default network location, under a
system providing *unix domain socket* that method is preferred, otherwise
the *netloc* default to `localhost`.
It's possible to force the *unix domain socket* path by using the syntax
`unix:/path/to/where/the/socket/file/is`, so to force a non default
socket path and a non default port, you would have:
postgresql://unix:/tmp:54321/dbname
The *netloc* defaults to the value of the `PGHOST` environment
variable, and if it is unset, to either the default `unix` socket path
when running on a Unix system, and `localhost` otherwise.
Socket path containing colons are supported by doubling the colons
within the path, as in the following example:
postgresql://unix:/tmp/project::region::instance:5432/dbname
- *dbname*
Should be a proper identifier (letter followed by a mix of letters,
digits and the punctuation signs comma (`,`), dash (`-`) and underscore
(`_`).
When omitted, the *dbname* defaults to the value of the environment
variable `PGDATABASE`, and if that is unset, to the *user* value as
determined above.
- *options*
The optional parameters must be supplied with the form `name=value`, and
you may use several parameters by separating them away using an
ampersand (`&`) character.
Only some options are supported here, *tablename* (which might be
qualified with a schema name) *sslmode*, *host*, *port*, *dbname*,
*user* and *password*.
The *sslmode* parameter values can be one of `disable`, `allow`,
`prefer` or `require`.
For backward compatibility reasons, it's possible to specify the
*tablename* option directly, without spelling out the `tablename=`
parts.
The options override the main URI components when both are given, and
using the percent-encoded option parameters allow using passwords
starting with a colon and bypassing other URI components parsing
limitations.
Regular Expressions
-------------------
Several clauses listed in the following accept *regular expressions* with
the following input rules:
- A regular expression begins with a tilde sign (`~`),
- is then followed with an opening sign,
- then any character is allowed and considered part of the regular
expression, except for the closing sign,
- then a closing sign is expected.
The opening and closing sign are allowed by pair, here's the complete list
of allowed delimiters::
~//
~[]
~{}
~()
~<>
~""
~''
~||
~##
Pick the set of delimiters that don't collide with the *regular expression*
you're trying to input. If your expression is such that none of the
solutions allow you to enter it, the places where such expressions are
allowed should allow for a list of expressions.
Comments
--------
Any command may contain comments, following those input rules:
- the `--` delimiter begins a comment that ends with the end of the
current line,
- the delimiters `/*` and `*/` respectively start and end a comment, which
can be found in the middle of a command or span several lines.
Any place where you could enter a *whitespace* will accept a comment too.
Batch behaviour options
-----------------------
All pgloader commands have support for a *WITH* clause that allows for
specifying options. Some options are generic and accepted by all commands,
such as the *batch behaviour options*, and some options are specific to a
data source kind, such as the CSV *skip header* option.
The global batch behaviour options are:
- *batch rows*
Takes a numeric value as argument, used as the maximum number of rows
allowed in a batch. The default is `25 000` and can be changed to try
having better performance characteristics or to control pgloader memory
usage;
- *batch size*
Takes a memory unit as argument, such as *20 MB*, its default value.
Accepted multipliers are *kB*, *MB*, *GB*, *TB* and *PB*. The case is
important so as not to be confused about bits versus bytes, we're only
talking bytes here.
- *prefetch rows*
Takes a numeric value as argument, defaults to `100000`. That's the
number of rows that pgloader is allowed to read in memory in each reader
thread. See the *workers* setting for how many reader threads are
allowed to run at the same time.
Other options are specific to each input source, please refer to specific
parts of the documentation for their listing and covering.
A batch is then closed as soon as either the *batch rows* or the *batch
size* threshold is crossed, whichever comes first. In cases when a batch has
to be closed because of the *batch size* setting, a *debug* level log
message is printed with how many rows did fit in the *oversized* batch.
Templating with Mustache
------------------------
pgloader implements the https://mustache.github.io/ templating system so
that you may have dynamic parts of your commands. See the documentation for
this template system online.
A specific feature of pgloader is the ability to fetch a variable from the
OS environment of the pgloader process, making it possible to run pgloader
as in the following example::
$ DBPATH=sqlite/sqlite.db pgloader ./test/sqlite-env.load
or in several steps::
$ export DBPATH=sqlite/sqlite.db
$ pgloader ./test/sqlite-env.load
The variable can then be used in a typical mustache fashion::
load database
from '{{DBPATH}}'
into postgresql:///pgloader;
It's also possible to prepare a INI file such as the following::
[pgloader]
DBPATH = sqlite/sqlite.db
And run the following command, feeding the INI values as a *context* for
pgloader templating system::
$ pgloader --context ./test/sqlite.ini ./test/sqlite-ini.load
The mustache templates implementation with OS environment support replaces
former `GETENV` implementation, which didn't work anyway.

118
docs/conf.py Normal file
View File

@ -0,0 +1,118 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pgloader documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 5 19:23:32 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'pgloader'
copyright = '2005-2022, Dimitri Fontaine'
author = 'Dimitri Fontaine'
version = '3.6'
release = '3.6.10'
# -- General configuration ------------------------------------------------
# The master toctree document.
master_doc = 'index'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pgloader.tex', 'pgloader Documentation',
'Dimitri Fontaine', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pgloader', 'pgloader Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pgloader', 'pgloader Documentation',
author, 'pgloader', 'One line description of project.',
'Miscellaneous'),
]

164
docs/dist/carousel.css vendored
View File

@ -1,164 +0,0 @@
/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */
body {
padding-bottom: 40px;
color: #5a5a5a;
}
/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */
/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 20;
}
/* Flip around the padding for proper display in narrow viewports */
.navbar-wrapper .container {
padding-left: 0;
padding-right: 0;
}
.navbar-wrapper .navbar {
padding-left: 15px;
padding-right: 15px;
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* Carousel base class */
.carousel {
height: 350px;
margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
z-index: 10;
}
.carousel-caption h1 {
color: orange;
}
.carousel-caption p {
text-align: justify;
}
/* Declare heights because of positioning of img element */
.carousel .item {
height: 350px;
background-color: #777;
}
.carousel-inner > .item > img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: 350px;
}
/* MARKETING CONTENT
-------------------------------------------------- */
/* Pad the edges of the mobile views a bit */
.marketing {
padding-left: 15px;
padding-right: 15px;
}
/* Center align the text within the three columns below the carousel */
.marketing .col-lg-4 {
text-align: center;
margin-bottom: 20px;
}
.marketing h2 {
font-weight: normal;
}
.marketing .col-lg-4 p {
margin-left: 10px;
margin-right: 10px;
}
/* Featurettes
------------------------- */
.featurette-divider {
margin: 80px 0; /* Space out the Bootstrap <hr> more */
}
/* Thin out the marketing headings */
.featurette-heading {
font-weight: 300;
line-height: 1;
letter-spacing: -1px;
}
/* RESPONSIVE CSS
-------------------------------------------------- */
@media (min-width: 768px) {
/* Remove the edge padding needed for mobile */
.marketing {
padding-left: 0;
padding-right: 0;
}
/* Navbar positioning foo */
.navbar-wrapper {
margin-top: 20px;
}
.navbar-wrapper .container {
padding-left: 15px;
padding-right: 15px;
}
.navbar-wrapper .navbar {
padding-left: 0;
padding-right: 0;
}
/* The navbar becomes detached from the top, so we round the corners */
.navbar-wrapper .navbar {
border-radius: 4px;
}
/* Bump up size of carousel content */
.carousel-caption p {
margin-bottom: 20px;
font-size: 21px;
line-height: 1.4;
}
.featurette-heading {
font-size: 50px;
}
}
/* @media (min-width: 992px) { */
/* .featurette-heading { */
/* margin-top: 120px; */
/* } */
/* } */
pre {
overflow: auto;
word-wrap: normal;
white-space: pre;
}
pre code {
white-space: pre;
}

View File

@ -1,397 +0,0 @@
/*!
* Bootstrap v3.0.3 (http://getbootstrap.com)
* Copyright 2013 Twitter, Inc.
* Licensed under http://www.apache.org/licenses/LICENSE-2.0
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #ffffff 0%, #e0e0e0 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%);
background-repeat: repeat-x;
border-color: #2b669a;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #2d6ca2;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #2d6ca2;
border-color: #2b669a;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
background-repeat: repeat-x;
border-color: #3e8f3e;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
background-repeat: repeat-x;
border-color: #e38d13;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
background-repeat: repeat-x;
border-color: #b92c28;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
background-repeat: repeat-x;
border-color: #28a4c9;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #357ebd;
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);
background-repeat: repeat-x;
border-radius: 4px;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222222 100%);
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #222222 0%, #282828 100%);
background-image: linear-gradient(to bottom, #222222 0%, #282828 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
background-repeat: repeat-x;
border-color: #b2dba1;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
background-repeat: repeat-x;
border-color: #9acfea;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
background-repeat: repeat-x;
border-color: #f5e79e;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
background-repeat: repeat-x;
border-color: #dca7a7;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #3071a9;
background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
background-repeat: repeat-x;
border-color: #3278b3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,229 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata></metadata>
<defs>
<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
<font-face units-per-em="1200" ascent="960" descent="-240" />
<missing-glyph horiz-adv-x="500" />
<glyph />
<glyph />
<glyph unicode="&#xd;" />
<glyph unicode=" " />
<glyph unicode="*" d="M100 500v200h259l-183 183l141 141l183 -183v259h200v-259l183 183l141 -141l-183 -183h259v-200h-259l183 -183l-141 -141l-183 183v-259h-200v259l-183 -183l-141 141l183 183h-259z" />
<glyph unicode="+" d="M0 400v300h400v400h300v-400h400v-300h-400v-400h-300v400h-400z" />
<glyph unicode="&#xa0;" />
<glyph unicode="&#x2000;" horiz-adv-x="652" />
<glyph unicode="&#x2001;" horiz-adv-x="1304" />
<glyph unicode="&#x2002;" horiz-adv-x="652" />
<glyph unicode="&#x2003;" horiz-adv-x="1304" />
<glyph unicode="&#x2004;" horiz-adv-x="434" />
<glyph unicode="&#x2005;" horiz-adv-x="326" />
<glyph unicode="&#x2006;" horiz-adv-x="217" />
<glyph unicode="&#x2007;" horiz-adv-x="217" />
<glyph unicode="&#x2008;" horiz-adv-x="163" />
<glyph unicode="&#x2009;" horiz-adv-x="260" />
<glyph unicode="&#x200a;" horiz-adv-x="72" />
<glyph unicode="&#x202f;" horiz-adv-x="260" />
<glyph unicode="&#x205f;" horiz-adv-x="326" />
<glyph unicode="&#x20ac;" d="M100 500l100 100h113q0 47 5 100h-218l100 100h135q37 167 112 257q117 141 297 141q242 0 354 -189q60 -103 66 -209h-181q0 55 -25.5 99t-63.5 68t-75 36.5t-67 12.5q-24 0 -52.5 -10t-62.5 -32t-65.5 -67t-50.5 -107h379l-100 -100h-300q-6 -46 -6 -100h406l-100 -100 h-300q9 -74 33 -132t52.5 -91t62 -54.5t59 -29t46.5 -7.5q29 0 66 13t75 37t63.5 67.5t25.5 96.5h174q-31 -172 -128 -278q-107 -117 -274 -117q-205 0 -324 158q-36 46 -69 131.5t-45 205.5h-217z" />
<glyph unicode="&#x2212;" d="M200 400h900v300h-900v-300z" />
<glyph unicode="&#x2601;" d="M-14 494q0 -80 56.5 -137t135.5 -57h750q120 0 205 86t85 208q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5z" />
<glyph unicode="&#x2709;" d="M0 100l400 400l200 -200l200 200l400 -400h-1200zM0 300v600l300 -300zM0 1100l600 -603l600 603h-1200zM900 600l300 300v-600z" />
<glyph unicode="&#x270f;" d="M-13 -13l333 112l-223 223zM187 403l214 -214l614 614l-214 214zM887 1103l214 -214l99 92q13 13 13 32.5t-13 33.5l-153 153q-15 13 -33 13t-33 -13z" />
<glyph unicode="&#xe000;" horiz-adv-x="500" d="M0 0z" />
<glyph unicode="&#xe001;" d="M0 1200h1200l-500 -550v-550h300v-100h-800v100h300v550z" />
<glyph unicode="&#xe002;" d="M14 84q18 -55 86 -75.5t147 5.5q65 21 109 69t44 90v606l600 155v-521q-64 16 -138 -7q-79 -26 -122.5 -83t-25.5 -111q17 -55 85.5 -75.5t147.5 4.5q70 23 111.5 63.5t41.5 95.5v881q0 10 -7 15.5t-17 2.5l-752 -193q-10 -3 -17 -12.5t-7 -19.5v-689q-64 17 -138 -7 q-79 -25 -122.5 -82t-25.5 -112z" />
<glyph unicode="&#xe003;" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233z" />
<glyph unicode="&#xe005;" d="M100 784q0 64 28 123t73 100.5t104.5 64t119 20.5t120 -38.5t104.5 -104.5q48 69 109.5 105t121.5 38t118.5 -20.5t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-149.5 152.5t-126.5 127.5 t-94 124.5t-33.5 117.5z" />
<glyph unicode="&#xe006;" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1z" />
<glyph unicode="&#xe007;" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1zM237 700l196 -142l-73 -226l192 140l195 -141l-74 229l193 140h-235l-77 211l-78 -211h-239z" />
<glyph unicode="&#xe008;" d="M0 0v143l400 257v100q-37 0 -68.5 74.5t-31.5 125.5v200q0 124 88 212t212 88t212 -88t88 -212v-200q0 -51 -31.5 -125.5t-68.5 -74.5v-100l400 -257v-143h-1200z" />
<glyph unicode="&#xe009;" d="M0 0v1100h1200v-1100h-1200zM100 100h100v100h-100v-100zM100 300h100v100h-100v-100zM100 500h100v100h-100v-100zM100 700h100v100h-100v-100zM100 900h100v100h-100v-100zM300 100h600v400h-600v-400zM300 600h600v400h-600v-400zM1000 100h100v100h-100v-100z M1000 300h100v100h-100v-100zM1000 500h100v100h-100v-100zM1000 700h100v100h-100v-100zM1000 900h100v100h-100v-100z" />
<glyph unicode="&#xe010;" d="M0 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM0 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5zM600 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM600 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5z" />
<glyph unicode="&#xe011;" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 450v200q0 21 14.5 35.5t35.5 14.5h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5z" />
<glyph unicode="&#xe012;" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v200q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5 t-14.5 -35.5v-200zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5z" />
<glyph unicode="&#xe013;" d="M29 454l419 -420l818 820l-212 212l-607 -607l-206 207z" />
<glyph unicode="&#xe014;" d="M106 318l282 282l-282 282l212 212l282 -282l282 282l212 -212l-282 -282l282 -282l-212 -212l-282 282l-282 -282z" />
<glyph unicode="&#xe015;" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233zM300 600v200h100v100h200v-100h100v-200h-100v-100h-200v100h-100z" />
<glyph unicode="&#xe016;" d="M23 694q0 200 142 342t342 142t342 -142t142 -342q0 -141 -78 -262l300 -299q7 -7 7 -18t-7 -18l-109 -109q-8 -8 -18 -8t-18 8l-300 299q-120 -77 -261 -77q-200 0 -342 142t-142 342zM176 694q0 -136 97 -233t234 -97t233.5 97t96.5 233t-96.5 233t-233.5 97t-234 -97 t-97 -233zM300 601h400v200h-400v-200z" />
<glyph unicode="&#xe017;" d="M23 600q0 183 105 331t272 210v-166q-103 -55 -165 -155t-62 -220q0 -177 125 -302t302 -125t302 125t125 302q0 120 -62 220t-165 155v166q167 -62 272 -210t105 -331q0 -118 -45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5 zM500 750q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v400q0 21 -14.5 35.5t-35.5 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-400z" />
<glyph unicode="&#xe018;" d="M100 1h200v300h-200v-300zM400 1v500h200v-500h-200zM700 1v800h200v-800h-200zM1000 1v1200h200v-1200h-200z" />
<glyph unicode="&#xe019;" d="M26 601q0 -33 6 -74l151 -38l2 -6q14 -49 38 -93l3 -5l-80 -134q45 -59 105 -105l133 81l5 -3q45 -26 94 -39l5 -2l38 -151q40 -5 74 -5q27 0 74 5l38 151l6 2q46 13 93 39l5 3l134 -81q56 44 104 105l-80 134l3 5q24 44 39 93l1 6l152 38q5 40 5 74q0 28 -5 73l-152 38 l-1 6q-16 51 -39 93l-3 5l80 134q-44 58 -104 105l-134 -81l-5 3q-45 25 -93 39l-6 1l-38 152q-40 5 -74 5q-27 0 -74 -5l-38 -152l-5 -1q-50 -14 -94 -39l-5 -3l-133 81q-59 -47 -105 -105l80 -134l-3 -5q-25 -47 -38 -93l-2 -6l-151 -38q-6 -48 -6 -73zM385 601 q0 88 63 151t152 63t152 -63t63 -151q0 -89 -63 -152t-152 -63t-152 63t-63 152z" />
<glyph unicode="&#xe020;" d="M100 1025v50q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-50q0 -11 -7 -18t-18 -7h-1050q-11 0 -18 7t-7 18zM200 100v800h900v-800q0 -41 -29.5 -71t-70.5 -30h-700q-41 0 -70.5 30 t-29.5 71zM300 100h100v700h-100v-700zM500 100h100v700h-100v-700zM500 1100h300v100h-300v-100zM700 100h100v700h-100v-700zM900 100h100v700h-100v-700z" />
<glyph unicode="&#xe021;" d="M1 601l656 644l644 -644h-200v-600h-300v400h-300v-400h-300v600h-200z" />
<glyph unicode="&#xe022;" d="M100 25v1150q0 11 7 18t18 7h475v-500h400v-675q0 -11 -7 -18t-18 -7h-850q-11 0 -18 7t-7 18zM700 800v300l300 -300h-300z" />
<glyph unicode="&#xe023;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 500v400h100 v-300h200v-100h-300z" />
<glyph unicode="&#xe024;" d="M-100 0l431 1200h209l-21 -300h162l-20 300h208l431 -1200h-538l-41 400h-242l-40 -400h-539zM488 500h224l-27 300h-170z" />
<glyph unicode="&#xe025;" d="M0 0v400h490l-290 300h200v500h300v-500h200l-290 -300h490v-400h-1100zM813 200h175v100h-175v-100z" />
<glyph unicode="&#xe026;" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM188 600q0 -170 121 -291t291 -121t291 121t121 291t-121 291t-291 121 t-291 -121t-121 -291zM350 600h150v300h200v-300h150l-250 -300z" />
<glyph unicode="&#xe027;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM350 600l250 300 l250 -300h-150v-300h-200v300h-150z" />
<glyph unicode="&#xe028;" d="M0 25v475l200 700h800q199 -700 200 -700v-475q0 -11 -7 -18t-18 -7h-1150q-11 0 -18 7t-7 18zM200 500h200l50 -200h300l50 200h200l-97 500h-606z" />
<glyph unicode="&#xe029;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 397v401 l297 -200z" />
<glyph unicode="&#xe030;" d="M23 600q0 -118 45.5 -224.5t123 -184t184 -123t224.5 -45.5t224.5 45.5t184 123t123 184t45.5 224.5h-150q0 -177 -125 -302t-302 -125t-302 125t-125 302t125 302t302 125q136 0 246 -81l-146 -146h400v400l-145 -145q-157 122 -355 122q-118 0 -224.5 -45.5t-184 -123 t-123 -184t-45.5 -224.5z" />
<glyph unicode="&#xe031;" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5q198 0 355 -122l145 145v-400h-400l147 147q-112 80 -247 80q-177 0 -302 -125t-125 -302h-150zM100 0v400h400l-147 -147q112 -80 247 -80q177 0 302 125t125 302h150q0 -118 -45.5 -224.5t-123 -184t-184 -123 t-224.5 -45.5q-198 0 -355 122z" />
<glyph unicode="&#xe032;" d="M100 0h1100v1200h-1100v-1200zM200 100v900h900v-900h-900zM300 200v100h100v-100h-100zM300 400v100h100v-100h-100zM300 600v100h100v-100h-100zM300 800v100h100v-100h-100zM500 200h500v100h-500v-100zM500 400v100h500v-100h-500zM500 600v100h500v-100h-500z M500 800v100h500v-100h-500z" />
<glyph unicode="&#xe033;" d="M0 100v600q0 41 29.5 70.5t70.5 29.5h100v200q0 82 59 141t141 59h300q82 0 141 -59t59 -141v-200h100q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-900q-41 0 -70.5 29.5t-29.5 70.5zM400 800h300v150q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-150z" />
<glyph unicode="&#xe034;" d="M100 0v1100h100v-1100h-100zM300 400q60 60 127.5 84t127.5 17.5t122 -23t119 -30t110 -11t103 42t91 120.5v500q-40 -81 -101.5 -115.5t-127.5 -29.5t-138 25t-139.5 40t-125.5 25t-103 -29.5t-65 -115.5v-500z" />
<glyph unicode="&#xe035;" d="M0 275q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 127 70.5 231.5t184.5 161.5t245 57t245 -57t184.5 -161.5t70.5 -231.5v-300q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 116 -49.5 227t-131 192.5t-192.5 131t-227 49.5t-227 -49.5t-192.5 -131t-131 -192.5 t-49.5 -227v-300zM200 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14zM800 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14z" />
<glyph unicode="&#xe036;" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM688 459l141 141l-141 141l71 71l141 -141l141 141l71 -71l-141 -141l141 -141l-71 -71l-141 141l-141 -141z" />
<glyph unicode="&#xe037;" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM700 857l69 53q111 -135 111 -310q0 -169 -106 -302l-67 54q86 110 86 248q0 146 -93 257z" />
<glyph unicode="&#xe038;" d="M0 401v400h300l300 200v-800l-300 200h-300zM702 858l69 53q111 -135 111 -310q0 -170 -106 -303l-67 55q86 110 86 248q0 145 -93 257zM889 951l7 -8q123 -151 123 -344q0 -189 -119 -339l-7 -8l81 -66l6 8q142 178 142 405q0 230 -144 408l-6 8z" />
<glyph unicode="&#xe039;" d="M0 0h500v500h-200v100h-100v-100h-200v-500zM0 600h100v100h400v100h100v100h-100v300h-500v-600zM100 100v300h300v-300h-300zM100 800v300h300v-300h-300zM200 200v100h100v-100h-100zM200 900h100v100h-100v-100zM500 500v100h300v-300h200v-100h-100v-100h-200v100 h-100v100h100v200h-200zM600 0v100h100v-100h-100zM600 1000h100v-300h200v-300h300v200h-200v100h200v500h-600v-200zM800 800v300h300v-300h-300zM900 0v100h300v-100h-300zM900 900v100h100v-100h-100zM1100 200v100h100v-100h-100z" />
<glyph unicode="&#xe040;" d="M0 200h100v1000h-100v-1000zM100 0v100h300v-100h-300zM200 200v1000h100v-1000h-100zM500 0v91h100v-91h-100zM500 200v1000h200v-1000h-200zM700 0v91h100v-91h-100zM800 200v1000h100v-1000h-100zM900 0v91h200v-91h-200zM1000 200v1000h200v-1000h-200z" />
<glyph unicode="&#xe041;" d="M1 700v475q0 10 7.5 17.5t17.5 7.5h474l700 -700l-500 -500zM148 953q0 -42 29 -71q30 -30 71.5 -30t71.5 30q29 29 29 71t-29 71q-30 30 -71.5 30t-71.5 -30q-29 -29 -29 -71z" />
<glyph unicode="&#xe042;" d="M2 700v475q0 11 7 18t18 7h474l700 -700l-500 -500zM148 953q0 -42 30 -71q29 -30 71 -30t71 30q30 29 30 71t-30 71q-29 30 -71 30t-71 -30q-30 -29 -30 -71zM701 1200h100l700 -700l-500 -500l-50 50l450 450z" />
<glyph unicode="&#xe043;" d="M100 0v1025l175 175h925v-1000l-100 -100v1000h-750l-100 -100h750v-1000h-900z" />
<glyph unicode="&#xe044;" d="M200 0l450 444l450 -443v1150q0 20 -14.5 35t-35.5 15h-800q-21 0 -35.5 -15t-14.5 -35v-1151z" />
<glyph unicode="&#xe045;" d="M0 100v700h200l100 -200h600l100 200h200v-700h-200v200h-800v-200h-200zM253 829l40 -124h592l62 124l-94 346q-2 11 -10 18t-18 7h-450q-10 0 -18 -7t-10 -18zM281 24l38 152q2 10 11.5 17t19.5 7h500q10 0 19.5 -7t11.5 -17l38 -152q2 -10 -3.5 -17t-15.5 -7h-600 q-10 0 -15.5 7t-3.5 17z" />
<glyph unicode="&#xe046;" d="M0 200q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-150q-4 8 -11.5 21.5t-33 48t-53 61t-69 48t-83.5 21.5h-200q-41 0 -82 -20.5t-70 -50t-52 -59t-34 -50.5l-12 -20h-150q-41 0 -70.5 -29.5t-29.5 -70.5v-600z M356 500q0 100 72 172t172 72t172 -72t72 -172t-72 -172t-172 -72t-172 72t-72 172zM494 500q0 -44 31 -75t75 -31t75 31t31 75t-31 75t-75 31t-75 -31t-31 -75zM900 700v100h100v-100h-100z" />
<glyph unicode="&#xe047;" d="M53 0h365v66q-41 0 -72 11t-49 38t1 71l92 234h391l82 -222q16 -45 -5.5 -88.5t-74.5 -43.5v-66h417v66q-34 1 -74 43q-18 19 -33 42t-21 37l-6 13l-385 998h-93l-399 -1006q-24 -48 -52 -75q-12 -12 -33 -25t-36 -20l-15 -7v-66zM416 521l178 457l46 -140l116 -317h-340 z" />
<glyph unicode="&#xe048;" d="M100 0v89q41 7 70.5 32.5t29.5 65.5v827q0 28 -1 39.5t-5.5 26t-15.5 21t-29 14t-49 14.5v70h471q120 0 213 -88t93 -228q0 -55 -11.5 -101.5t-28 -74t-33.5 -47.5t-28 -28l-12 -7q8 -3 21.5 -9t48 -31.5t60.5 -58t47.5 -91.5t21.5 -129q0 -84 -59 -156.5t-142 -111 t-162 -38.5h-500zM400 200h161q89 0 153 48.5t64 132.5q0 90 -62.5 154.5t-156.5 64.5h-159v-400zM400 700h139q76 0 130 61.5t54 138.5q0 82 -84 130.5t-239 48.5v-379z" />
<glyph unicode="&#xe049;" d="M200 0v57q77 7 134.5 40.5t65.5 80.5l173 849q10 56 -10 74t-91 37q-6 1 -10.5 2.5t-9.5 2.5v57h425l2 -57q-33 -8 -62 -25.5t-46 -37t-29.5 -38t-17.5 -30.5l-5 -12l-128 -825q-10 -52 14 -82t95 -36v-57h-500z" />
<glyph unicode="&#xe050;" d="M-75 200h75v800h-75l125 167l125 -167h-75v-800h75l-125 -167zM300 900v300h150h700h150v-300h-50q0 29 -8 48.5t-18.5 30t-33.5 15t-39.5 5.5t-50.5 1h-200v-850l100 -50v-100h-400v100l100 50v850h-200q-34 0 -50.5 -1t-40 -5.5t-33.5 -15t-18.5 -30t-8.5 -48.5h-49z " />
<glyph unicode="&#xe051;" d="M33 51l167 125v-75h800v75l167 -125l-167 -125v75h-800v-75zM100 901v300h150h700h150v-300h-50q0 29 -8 48.5t-18 30t-33.5 15t-40 5.5t-50.5 1h-200v-650l100 -50v-100h-400v100l100 50v650h-200q-34 0 -50.5 -1t-39.5 -5.5t-33.5 -15t-18.5 -30t-8 -48.5h-50z" />
<glyph unicode="&#xe052;" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 350q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM0 650q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1000q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 950q0 -20 14.5 -35t35.5 -15h600q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-600q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
<glyph unicode="&#xe053;" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 650q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM200 350q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM200 950q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
<glyph unicode="&#xe054;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1000q-21 0 -35.5 15 t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-600 q-21 0 -35.5 15t-14.5 35z" />
<glyph unicode="&#xe055;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100 q-21 0 -35.5 15t-14.5 35z" />
<glyph unicode="&#xe056;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM300 50v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800 q-21 0 -35.5 15t-14.5 35zM300 650v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 950v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15 h-800q-21 0 -35.5 15t-14.5 35z" />
<glyph unicode="&#xe057;" d="M-101 500v100h201v75l166 -125l-166 -125v75h-201zM300 0h100v1100h-100v-1100zM500 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35 v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 650q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100 q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100z" />
<glyph unicode="&#xe058;" d="M1 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 650 q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM801 0v1100h100v-1100 h-100zM934 550l167 -125v75h200v100h-200v75z" />
<glyph unicode="&#xe059;" d="M0 275v650q0 31 22 53t53 22h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53zM900 600l300 300v-600z" />
<glyph unicode="&#xe060;" d="M0 44v1012q0 18 13 31t31 13h1112q19 0 31.5 -13t12.5 -31v-1012q0 -18 -12.5 -31t-31.5 -13h-1112q-18 0 -31 13t-13 31zM100 263l247 182l298 -131l-74 156l293 318l236 -288v500h-1000v-737zM208 750q0 56 39 95t95 39t95 -39t39 -95t-39 -95t-95 -39t-95 39t-39 95z " />
<glyph unicode="&#xe062;" d="M148 745q0 124 60.5 231.5t165 172t226.5 64.5q123 0 227 -63t164.5 -169.5t60.5 -229.5t-73 -272q-73 -114 -166.5 -237t-150.5 -189l-57 -66q-10 9 -27 26t-66.5 70.5t-96 109t-104 135.5t-100.5 155q-63 139 -63 262zM342 772q0 -107 75.5 -182.5t181.5 -75.5 q107 0 182.5 75.5t75.5 182.5t-75.5 182t-182.5 75t-182 -75.5t-75 -181.5z" />
<glyph unicode="&#xe063;" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM173 600q0 -177 125.5 -302t301.5 -125v854q-176 0 -301.5 -125 t-125.5 -302z" />
<glyph unicode="&#xe064;" d="M117 406q0 94 34 186t88.5 172.5t112 159t115 177t87.5 194.5q21 -71 57.5 -142.5t76 -130.5t83 -118.5t82 -117t70 -116t50 -125.5t18.5 -136q0 -89 -39 -165.5t-102 -126.5t-140 -79.5t-156 -33.5q-114 6 -211.5 53t-161.5 138.5t-64 210.5zM243 414q14 -82 59.5 -136 t136.5 -80l16 98q-7 6 -18 17t-34 48t-33 77q-15 73 -14 143.5t10 122.5l9 51q-92 -110 -119.5 -185t-12.5 -156z" />
<glyph unicode="&#xe065;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5q366 -6 397 -14l-186 -186h-311q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v125l200 200v-225q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM436 341l161 50l412 412l-114 113l-405 -405zM995 1015l113 -113l113 113l-21 85l-92 28z" />
<glyph unicode="&#xe066;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h261l2 -80q-133 -32 -218 -120h-145q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-53q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5 zM423 524q30 38 81.5 64t103 35.5t99 14t77.5 3.5l29 -1v-209l360 324l-359 318v-216q-7 0 -19 -1t-48 -8t-69.5 -18.5t-76.5 -37t-76.5 -59t-62 -88t-39.5 -121.5z" />
<glyph unicode="&#xe067;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-169q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM342 632l283 -284l566 567l-136 137l-430 -431l-147 147z" />
<glyph unicode="&#xe068;" d="M0 603l300 296v-198h200v200h-200l300 300l295 -300h-195v-200h200v198l300 -296l-300 -300v198h-200v-200h195l-295 -300l-300 300h200v200h-200v-198z" />
<glyph unicode="&#xe069;" d="M200 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-1100l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
<glyph unicode="&#xe070;" d="M0 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-487l500 487v-1100l-500 488v-488l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
<glyph unicode="&#xe071;" d="M136 550l564 550v-487l500 487v-1100l-500 488v-488z" />
<glyph unicode="&#xe072;" d="M200 0l900 550l-900 550v-1100z" />
<glyph unicode="&#xe073;" d="M200 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-800zM600 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
<glyph unicode="&#xe074;" d="M200 150q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v800q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
<glyph unicode="&#xe075;" d="M0 0v1100l500 -487v487l564 -550l-564 -550v488z" />
<glyph unicode="&#xe076;" d="M0 0v1100l500 -487v487l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-500 -488v488z" />
<glyph unicode="&#xe077;" d="M300 0v1100l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438z" />
<glyph unicode="&#xe078;" d="M100 250v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5zM100 500h1100l-550 564z" />
<glyph unicode="&#xe079;" d="M185 599l592 -592l240 240l-353 353l353 353l-240 240z" />
<glyph unicode="&#xe080;" d="M272 194l353 353l-353 353l241 240l572 -571l21 -22l-1 -1v-1l-592 -591z" />
<glyph unicode="&#xe081;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -300t-217.5 -218t-299.5 -80t-299.5 80t-217.5 218t-80 300zM300 500h200v-200h200v200h200v200h-200v200h-200v-200h-200v-200z" />
<glyph unicode="&#xe082;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -300t-217.5 -218t-299.5 -80t-299.5 80t-217.5 218t-80 300zM300 500h600v200h-600v-200z" />
<glyph unicode="&#xe083;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -300t-217.5 -218t-299.5 -80t-299.5 80t-217.5 218t-80 300zM246 459l213 -213l141 142l141 -142l213 213l-142 141l142 141l-213 212l-141 -141l-141 142l-212 -213l141 -141z" />
<glyph unicode="&#xe084;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM270 551l276 -277l411 411l-175 174l-236 -236l-102 102z" />
<glyph unicode="&#xe085;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -300t-217.5 -218t-299.5 -80t-299.5 80t-217.5 218t-80 300zM363 700h144q4 0 11.5 -1t11 -1t6.5 3t3 9t1 11t3.5 8.5t3.5 6t5.5 4t6.5 2.5t9 1.5t9 0.5h11.5h12.5q19 0 30 -10t11 -26 q0 -22 -4 -28t-27 -22q-5 -1 -12.5 -3t-27 -13.5t-34 -27t-26.5 -46t-11 -68.5h200q5 3 14 8t31.5 25.5t39.5 45.5t31 69t14 94q0 51 -17.5 89t-42 58t-58.5 32t-58.5 15t-51.5 3q-105 0 -172 -56t-67 -183zM500 300h200v100h-200v-100z" />
<glyph unicode="&#xe086;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -300t-217.5 -218t-299.5 -80t-299.5 80t-217.5 218t-80 300zM400 300h400v100h-100v300h-300v-100h100v-200h-100v-100zM500 800h200v100h-200v-100z" />
<glyph unicode="&#xe087;" d="M0 500v200h194q15 60 36 104.5t55.5 86t88 69t126.5 40.5v200h200v-200q54 -20 113 -60t112.5 -105.5t71.5 -134.5h203v-200h-203q-25 -102 -116.5 -186t-180.5 -117v-197h-200v197q-140 27 -208 102.5t-98 200.5h-194zM290 500q24 -73 79.5 -127.5t130.5 -78.5v206h200 v-206q149 48 201 206h-201v200h200q-25 74 -76 127.5t-124 76.5v-204h-200v203q-75 -24 -130 -77.5t-79 -125.5h209v-200h-210z" />
<glyph unicode="&#xe088;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM356 465l135 135 l-135 135l109 109l135 -135l135 135l109 -109l-135 -135l135 -135l-109 -109l-135 135l-135 -135z" />
<glyph unicode="&#xe089;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM322 537l141 141 l87 -87l204 205l142 -142l-346 -345z" />
<glyph unicode="&#xe090;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -115 62 -215l568 567q-100 62 -216 62q-171 0 -292.5 -121.5t-121.5 -292.5zM391 245q97 -59 209 -59q171 0 292.5 121.5t121.5 292.5 q0 112 -59 209z" />
<glyph unicode="&#xe091;" d="M0 547l600 453v-300h600v-300h-600v-301z" />
<glyph unicode="&#xe092;" d="M0 400v300h600v300l600 -453l-600 -448v301h-600z" />
<glyph unicode="&#xe093;" d="M204 600l450 600l444 -600h-298v-600h-300v600h-296z" />
<glyph unicode="&#xe094;" d="M104 600h296v600h300v-600h298l-449 -600z" />
<glyph unicode="&#xe095;" d="M0 200q6 132 41 238.5t103.5 193t184 138t271.5 59.5v271l600 -453l-600 -448v301q-95 -2 -183 -20t-170 -52t-147 -92.5t-100 -135.5z" />
<glyph unicode="&#xe096;" d="M0 0v400l129 -129l294 294l142 -142l-294 -294l129 -129h-400zM635 777l142 -142l294 294l129 -129v400h-400l129 -129z" />
<glyph unicode="&#xe097;" d="M34 176l295 295l-129 129h400v-400l-129 130l-295 -295zM600 600v400l129 -129l295 295l142 -141l-295 -295l129 -130h-400z" />
<glyph unicode="&#xe101;" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5t224.5 -45.5t184 -123t123 -184t45.5 -224.5t-45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5zM456 851l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5 t21.5 34.5l58 302q4 20 -8 34.5t-33 14.5h-207q-20 0 -32 -14.5t-8 -34.5zM500 300h200v100h-200v-100z" />
<glyph unicode="&#xe102;" d="M0 800h100v-200h400v300h200v-300h400v200h100v100h-111v6t-1 15t-3 18l-34 172q-11 39 -41.5 63t-69.5 24q-32 0 -61 -17l-239 -144q-22 -13 -40 -35q-19 24 -40 36l-238 144q-33 18 -62 18q-39 0 -69.5 -23t-40.5 -61l-35 -177q-2 -8 -3 -18t-1 -15v-6h-111v-100z M100 0h400v400h-400v-400zM200 900q-3 0 14 48t35 96l18 47l214 -191h-281zM700 0v400h400v-400h-400zM731 900l202 197q5 -12 12 -32.5t23 -64t25 -72t7 -28.5h-269z" />
<glyph unicode="&#xe103;" d="M0 -22v143l216 193q-9 53 -13 83t-5.5 94t9 113t38.5 114t74 124q47 60 99.5 102.5t103 68t127.5 48t145.5 37.5t184.5 43.5t220 58.5q0 -189 -22 -343t-59 -258t-89 -181.5t-108.5 -120t-122 -68t-125.5 -30t-121.5 -1.5t-107.5 12.5t-87.5 17t-56.5 7.5l-99 -55z M238.5 300.5q19.5 -6.5 86.5 76.5q55 66 367 234q70 38 118.5 69.5t102 79t99 111.5t86.5 148q22 50 24 60t-6 19q-7 5 -17 5t-26.5 -14.5t-33.5 -39.5q-35 -51 -113.5 -108.5t-139.5 -89.5l-61 -32q-369 -197 -458 -401q-48 -111 -28.5 -117.5z" />
<glyph unicode="&#xe104;" d="M111 408q0 -33 5 -63q9 -56 44 -119.5t105 -108.5q31 -21 64 -16t62 23.5t57 49.5t48 61.5t35 60.5q32 66 39 184.5t-13 157.5q79 -80 122 -164t26 -184q-5 -33 -20.5 -69.5t-37.5 -80.5q-10 -19 -14.5 -29t-12 -26t-9 -23.5t-3 -19t2.5 -15.5t11 -9.5t19.5 -5t30.5 2.5 t42 8q57 20 91 34t87.5 44.5t87 64t65.5 88.5t47 122q38 172 -44.5 341.5t-246.5 278.5q22 -44 43 -129q39 -159 -32 -154q-15 2 -33 9q-79 33 -120.5 100t-44 175.5t48.5 257.5q-13 -8 -34 -23.5t-72.5 -66.5t-88.5 -105.5t-60 -138t-8 -166.5q2 -12 8 -41.5t8 -43t6 -39.5 t3.5 -39.5t-1 -33.5t-6 -31.5t-13.5 -24t-21 -20.5t-31 -12q-38 -10 -67 13t-40.5 61.5t-15 81.5t10.5 75q-52 -46 -83.5 -101t-39 -107t-7.5 -85z" />
<glyph unicode="&#xe105;" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5t145.5 -23.5t132.5 -59t116.5 -83.5t97 -90t74.5 -85.5t49 -63.5t20 -30l26 -40l-26 -40q-6 -10 -20 -30t-49 -63.5t-74.5 -85.5t-97 -90t-116.5 -83.5t-132.5 -59t-145.5 -23.5 t-145.5 23.5t-132.5 59t-116.5 83.5t-97 90t-74.5 85.5t-49 63.5t-20 30zM120 600q7 -10 40.5 -58t56 -78.5t68 -77.5t87.5 -75t103 -49.5t125 -21.5t123.5 20t100.5 45.5t85.5 71.5t66.5 75.5t58 81.5t47 66q-1 1 -28.5 37.5t-42 55t-43.5 53t-57.5 63.5t-58.5 54 q49 -74 49 -163q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l105 105q-37 24 -75 72t-57 84l-20 36z" />
<glyph unicode="&#xe106;" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5q61 0 121 -17l37 142h148l-314 -1200h-148l37 143q-82 21 -165 71.5t-140 102t-109.5 112t-72 88.5t-29.5 43zM120 600q210 -282 393 -336l37 141q-107 18 -178.5 101.5t-71.5 193.5 q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l47 47l23 87q-30 28 -59 69t-44 68l-14 26zM780 161l38 145q22 15 44.5 34t46 44t40.5 44t41 50.5t33.5 43.5t33 44t24.5 34q-97 127 -140 175l39 146q67 -54 131.5 -125.5t87.5 -103.5t36 -52l26 -40l-26 -40 q-7 -12 -25.5 -38t-63.5 -79.5t-95.5 -102.5t-124 -100t-146.5 -79z" />
<glyph unicode="&#xe107;" d="M-97.5 34q13.5 -34 50.5 -34h1294q37 0 50.5 35.5t-7.5 67.5l-642 1056q-20 33 -48 36t-48 -29l-642 -1066q-21 -32 -7.5 -66zM155 200l445 723l445 -723h-345v100h-200v-100h-345zM500 600l100 -300l100 300v100h-200v-100z" />
<glyph unicode="&#xe108;" d="M100 262v41q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44t106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -91 100 -113v-64q0 -21 -13 -29t-32 1l-94 78h-222l-94 -78q-19 -9 -32 -1t-13 29v64 q0 22 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5z" />
<glyph unicode="&#xe109;" d="M0 50q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v750h-1100v-750zM0 900h1100v150q0 21 -14.5 35.5t-35.5 14.5h-150v100h-100v-100h-500v100h-100v-100h-150q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 100v100h100v-100h-100zM100 300v100h100v-100h-100z M100 500v100h100v-100h-100zM300 100v100h100v-100h-100zM300 300v100h100v-100h-100zM300 500v100h100v-100h-100zM500 100v100h100v-100h-100zM500 300v100h100v-100h-100zM500 500v100h100v-100h-100zM700 100v100h100v-100h-100zM700 300v100h100v-100h-100zM700 500 v100h100v-100h-100zM900 100v100h100v-100h-100zM900 300v100h100v-100h-100zM900 500v100h100v-100h-100z" />
<glyph unicode="&#xe110;" d="M0 200v200h259l600 600h241v198l300 -295l-300 -300v197h-159l-600 -600h-341zM0 800h259l122 -122l141 142l-181 180h-341v-200zM678 381l141 142l122 -123h159v198l300 -295l-300 -300v197h-241z" />
<glyph unicode="&#xe111;" d="M0 400v600q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5z" />
<glyph unicode="&#xe112;" d="M100 600v200h300v-250q0 -113 6 -145q17 -92 102 -117q39 -11 92 -11q37 0 66.5 5.5t50 15.5t36 24t24 31.5t14 37.5t7 42t2.5 45t0 47v25v250h300v-200q0 -42 -3 -83t-15 -104t-31.5 -116t-58 -109.5t-89 -96.5t-129 -65.5t-174.5 -25.5t-174.5 25.5t-129 65.5t-89 96.5 t-58 109.5t-31.5 116t-15 104t-3 83zM100 900v300h300v-300h-300zM800 900v300h300v-300h-300z" />
<glyph unicode="&#xe113;" d="M-30 411l227 -227l352 353l353 -353l226 227l-578 579z" />
<glyph unicode="&#xe114;" d="M70 797l580 -579l578 579l-226 227l-353 -353l-352 353z" />
<glyph unicode="&#xe115;" d="M-198 700l299 283l300 -283h-203v-400h385l215 -200h-800v600h-196zM402 1000l215 -200h381v-400h-198l299 -283l299 283h-200v600h-796z" />
<glyph unicode="&#xe116;" d="M18 939q-5 24 10 42q14 19 39 19h896l38 162q5 17 18.5 27.5t30.5 10.5h94q20 0 35 -14.5t15 -35.5t-15 -35.5t-35 -14.5h-54l-201 -961q-2 -4 -6 -10.5t-19 -17.5t-33 -11h-31v-50q0 -20 -14.5 -35t-35.5 -15t-35.5 15t-14.5 35v50h-300v-50q0 -20 -14.5 -35t-35.5 -15 t-35.5 15t-14.5 35v50h-50q-21 0 -35.5 15t-14.5 35q0 21 14.5 35.5t35.5 14.5h535l48 200h-633q-32 0 -54.5 21t-27.5 43z" />
<glyph unicode="&#xe117;" d="M0 0v800h1200v-800h-1200zM0 900v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-100h-1200z" />
<glyph unicode="&#xe118;" d="M1 0l300 700h1200l-300 -700h-1200zM1 400v600h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-200h-1000z" />
<glyph unicode="&#xe119;" d="M302 300h198v600h-198l298 300l298 -300h-198v-600h198l-298 -300z" />
<glyph unicode="&#xe120;" d="M0 600l300 298v-198h600v198l300 -298l-300 -297v197h-600v-197z" />
<glyph unicode="&#xe121;" d="M0 100v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM31 400l172 739q5 22 23 41.5t38 19.5h672q19 0 37.5 -22.5t23.5 -45.5l172 -732h-1138zM800 100h100v100h-100v-100z M1000 100h100v100h-100v-100z" />
<glyph unicode="&#xe122;" d="M-101 600v50q0 24 25 49t50 38l25 13v-250l-11 5.5t-24 14t-30 21.5t-24 27.5t-11 31.5zM99 500v250v5q0 13 0.5 18.5t2.5 13t8 10.5t15 3h200l675 250v-850l-675 200h-38l47 -276q2 -12 -3 -17.5t-11 -6t-21 -0.5h-8h-83q-20 0 -34.5 14t-18.5 35q-56 337 -56 351z M1100 200v850q0 21 14.5 35.5t35.5 14.5q20 0 35 -14.5t15 -35.5v-850q0 -20 -15 -35t-35 -15q-21 0 -35.5 15t-14.5 35z" />
<glyph unicode="&#xe123;" d="M74 350q0 21 13.5 35.5t33.5 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3 32t29 13h94q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q20 0 33.5 -14.5t13.5 -35.5q0 -20 -13 -40t-31 -27q-22 -9 -63 -23t-167.5 -37 t-251.5 -23t-245.5 20.5t-178.5 41.5l-58 20q-18 7 -31 27.5t-13 40.5zM497 110q12 -49 40 -79.5t63 -30.5t63 30.5t39 79.5q-48 -6 -102 -6t-103 6z" />
<glyph unicode="&#xe124;" d="M21 445l233 -45l-78 -224l224 78l45 -233l155 179l155 -179l45 233l224 -78l-78 224l234 45l-180 155l180 156l-234 44l78 225l-224 -78l-45 233l-155 -180l-155 180l-45 -233l-224 78l78 -225l-233 -44l179 -156z" />
<glyph unicode="&#xe125;" d="M0 200h200v600h-200v-600zM300 275q0 -75 100 -75h61q123 -100 139 -100h250q46 0 83 57l238 344q29 31 29 74v100q0 44 -30.5 84.5t-69.5 40.5h-328q28 118 28 125v150q0 44 -30.5 84.5t-69.5 40.5h-50q-27 0 -51 -20t-38 -48l-96 -198l-145 -196q-20 -26 -20 -63v-400z M400 300v375l150 212l100 213h50v-175l-50 -225h450v-125l-250 -375h-214l-136 100h-100z" />
<glyph unicode="&#xe126;" d="M0 400v600h200v-600h-200zM300 525v400q0 75 100 75h61q123 100 139 100h250q46 0 83 -57l238 -344q29 -31 29 -74v-100q0 -44 -30.5 -84.5t-69.5 -40.5h-328q28 -118 28 -125v-150q0 -44 -30.5 -84.5t-69.5 -40.5h-50q-27 0 -51 20t-38 48l-96 198l-145 196 q-20 26 -20 63zM400 525l150 -212l100 -213h50v175l-50 225h450v125l-250 375h-214l-136 -100h-100v-375z" />
<glyph unicode="&#xe127;" d="M8 200v600h200v-600h-200zM308 275v525q0 17 14 35.5t28 28.5l14 9l362 230q14 6 25 6q17 0 29 -12l109 -112q14 -14 14 -34q0 -18 -11 -32l-85 -121h302q85 0 138.5 -38t53.5 -110t-54.5 -111t-138.5 -39h-107l-130 -339q-7 -22 -20.5 -41.5t-28.5 -19.5h-341 q-7 0 -90 81t-83 94zM408 289l100 -89h293l131 339q6 21 19.5 41t28.5 20h203q16 0 25 15t9 36q0 20 -9 34.5t-25 14.5h-457h-6.5h-7.5t-6.5 0.5t-6 1t-5 1.5t-5.5 2.5t-4 4t-4 5.5q-5 12 -5 20q0 14 10 27l147 183l-86 83l-339 -236v-503z" />
<glyph unicode="&#xe128;" d="M-101 651q0 72 54 110t139 37h302l-85 121q-11 16 -11 32q0 21 14 34l109 113q13 12 29 12q11 0 25 -6l365 -230q7 -4 16.5 -10.5t26 -26t16.5 -36.5v-526q0 -13 -85.5 -93.5t-93.5 -80.5h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-84 0 -139 39t-55 111zM-1 601h222 q15 0 28.5 -20.5t19.5 -40.5l131 -339h293l106 89v502l-342 237l-87 -83l145 -184q10 -11 10 -26q0 -11 -5 -20q-1 -3 -3.5 -5.5l-4 -4t-5 -2.5t-5.5 -1.5t-6.5 -1t-6.5 -0.5h-7.5h-6.5h-476v-100zM999 201v600h200v-600h-200z" />
<glyph unicode="&#xe129;" d="M97 719l230 -363q4 -6 10.5 -15.5t26 -25t36.5 -15.5h525q13 0 94 83t81 90v342q0 15 -20 28.5t-41 19.5l-339 131v106q0 84 -39 139t-111 55t-110 -53.5t-38 -138.5v-302l-121 84q-15 12 -33.5 11.5t-32.5 -13.5l-112 -110q-22 -22 -6 -53zM172 739l83 86l183 -146 q22 -18 47 -5q3 1 5.5 3.5l4 4t2.5 5t1.5 5.5t1 6.5t0.5 6v7.5v7v456q0 22 25 31t50 -0.5t25 -30.5v-202q0 -16 20 -29.5t41 -19.5l339 -130v-294l-89 -100h-503zM400 0v200h600v-200h-600z" />
<glyph unicode="&#xe130;" d="M1 585q-15 -31 7 -53l112 -110q13 -13 32 -13.5t34 10.5l121 85l-1 -302q0 -84 38.5 -138t110.5 -54t111 55t39 139v106l339 131q20 6 40.5 19.5t20.5 28.5v342q0 7 -81 90t-94 83h-525q-17 0 -35.5 -14t-28.5 -28l-10 -15zM76 565l237 339h503l89 -100v-294l-340 -130 q-20 -6 -40 -20t-20 -29v-202q0 -22 -25 -31t-50 0t-25 31v456v14.5t-1.5 11.5t-5 12t-9.5 7q-24 13 -46 -5l-184 -146zM305 1104v200h600v-200h-600z" />
<glyph unicode="&#xe131;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 500h300l-2 -194l402 294l-402 298v-197h-298v-201z" />
<glyph unicode="&#xe132;" d="M0 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t231.5 47.5q122 0 232.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-218 -217.5t-300 -80t-299.5 80t-217.5 217.5t-80 299.5zM200 600l400 -294v194h302v201h-300v197z" />
<glyph unicode="&#xe133;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600h200v-300h200v300h200l-300 400z" />
<glyph unicode="&#xe134;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600l300 -400l300 400h-200v300h-200v-300h-200z" />
<glyph unicode="&#xe135;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM254 780q-8 -34 5.5 -93t7.5 -87q0 -9 17 -44t16 -60q12 0 23 -5.5 t23 -15t20 -13.5q20 -10 108 -42q22 -8 53 -31.5t59.5 -38.5t57.5 -11q8 -18 -15 -55.5t-20 -57.5q12 -21 22.5 -34.5t28 -27t36.5 -17.5q0 -6 -3 -15.5t-3.5 -14.5t4.5 -17q101 -2 221 111q31 30 47 48t34 49t21 62q-14 9 -37.5 9.5t-35.5 7.5q-14 7 -49 15t-52 19 q-9 0 -39.5 -0.5t-46.5 -1.5t-39 -6.5t-39 -16.5q-50 -35 -66 -12q-4 2 -3.5 25.5t0.5 25.5q-6 13 -26.5 17t-24.5 7q2 22 -2 41t-16.5 28t-38.5 -20q-23 -25 -42 4q-19 28 -8 58q8 16 22 22q6 -1 26 -1.5t33.5 -4.5t19.5 -13q12 -19 32 -37.5t34 -27.5l14 -8q0 3 9.5 39.5 t5.5 57.5q-4 23 14.5 44.5t22.5 31.5q5 14 10 35t8.5 31t15.5 22.5t34 21.5q-6 18 10 37q8 0 23.5 -1.5t24.5 -1.5t20.5 4.5t20.5 15.5q-10 23 -30.5 42.5t-38 30t-49 26.5t-43.5 23q11 41 1 44q31 -13 58.5 -14.5t39.5 3.5l11 4q6 36 -17 53.5t-64 28.5t-56 23 q-19 -3 -37 0q-15 -12 -36.5 -21t-34.5 -12t-44 -8t-39 -6q-15 -3 -46 0t-45 -3q-20 -6 -51.5 -25.5t-34.5 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -91t-29.5 -79zM518 915q3 12 16 30.5t16 25.5q10 -10 18.5 -10t14 6t14.5 14.5t16 12.5q0 -18 8 -42.5t16.5 -44 t9.5 -23.5q-6 1 -39 5t-53.5 10t-36.5 16z" />
<glyph unicode="&#xe136;" d="M0 164.5q0 21.5 15 37.5l600 599q-33 101 6 201.5t135 154.5q164 92 306 -9l-259 -138l145 -232l251 126q13 -175 -151 -267q-123 -70 -253 -23l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5z" />
<glyph unicode="&#xe137;" horiz-adv-x="1220" d="M0 196v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 596v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5zM0 996v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM600 596h500v100h-500v-100zM800 196h300v100h-300v-100zM900 996h200v100h-200v-100z" />
<glyph unicode="&#xe138;" d="M100 1100v100h1000v-100h-1000zM150 1000h900l-350 -500v-300l-200 -200v500z" />
<glyph unicode="&#xe139;" d="M0 200v200h1200v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500z M500 1000h200v100h-200v-100z" />
<glyph unicode="&#xe140;" d="M0 0v400l129 -129l200 200l142 -142l-200 -200l129 -129h-400zM0 800l129 129l200 -200l142 142l-200 200l129 129h-400v-400zM729 329l142 142l200 -200l129 129v-400h-400l129 129zM729 871l200 200l-129 129h400v-400l-129 129l-200 -200z" />
<glyph unicode="&#xe141;" d="M0 596q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 596q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM291 655 q0 23 15.5 38.5t38.5 15.5t39 -16t16 -38q0 -23 -16 -39t-39 -16q-22 0 -38 16t-16 39zM400 850q0 22 16 38.5t39 16.5q22 0 38 -16t16 -39t-16 -39t-38 -16q-23 0 -39 16.5t-16 38.5zM513 609q0 32 21 56.5t52 29.5l122 126l1 1q-9 14 -9 28q0 22 16 38.5t39 16.5 q22 0 38 -16t16 -39t-16 -39t-38 -16q-16 0 -29 10l-55 -145q17 -22 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5q-37 0 -62.5 25.5t-25.5 61.5zM800 655q0 22 16 38t39 16t38.5 -15.5t15.5 -38.5t-16 -39t-38 -16q-23 0 -39 16t-16 39z" />
<glyph unicode="&#xe142;" d="M-40 375q-13 -95 35 -173q35 -57 94 -89t129 -32q63 0 119 28q33 16 65 40.5t52.5 45.5t59.5 64q40 44 57 61l394 394q35 35 47 84t-3 96q-27 87 -117 104q-20 2 -29 2q-46 0 -79.5 -17t-67.5 -51l-388 -396l-7 -7l69 -67l377 373q20 22 39 38q23 23 50 23q38 0 53 -36 q16 -39 -20 -75l-547 -547q-52 -52 -125 -52q-55 0 -100 33t-54 96q-5 35 2.5 66t31.5 63t42 50t56 54q24 21 44 41l348 348q52 52 82.5 79.5t84 54t107.5 26.5q25 0 48 -4q95 -17 154 -94.5t51 -175.5q-7 -101 -98 -192l-252 -249l-253 -256l7 -7l69 -60l517 511 q67 67 95 157t11 183q-16 87 -67 154t-130 103q-69 33 -152 33q-107 0 -197 -55q-40 -24 -111 -95l-512 -512q-68 -68 -81 -163z" />
<glyph unicode="&#xe143;" d="M79 784q0 131 99 229.5t230 98.5q144 0 242 -129q103 129 245 129q130 0 227 -98.5t97 -229.5q0 -46 -17.5 -91t-61 -99t-77 -89.5t-104.5 -105.5q-197 -191 -293 -322l-17 -23l-16 23q-43 58 -100 122.5t-92 99.5t-101 100l-84.5 84.5t-68 74t-60 78t-33.5 70.5t-15 78z M250 784q0 -27 30.5 -70t61.5 -75.5t95 -94.5l22 -22q93 -90 190 -201q82 92 195 203l12 12q64 62 97.5 97t64.5 79t31 72q0 71 -48 119.5t-106 48.5q-73 0 -131 -83l-118 -171l-114 174q-51 80 -124 80q-59 0 -108.5 -49.5t-49.5 -118.5z" />
<glyph unicode="&#xe144;" d="M57 353q0 -94 66 -160l141 -141q66 -66 159 -66q95 0 159 66l283 283q66 66 66 159t-66 159l-141 141q-12 12 -19 17l-105 -105l212 -212l-389 -389l-247 248l95 95l-18 18q-46 45 -75 101l-55 -55q-66 -66 -66 -159zM269 706q0 -93 66 -159l141 -141l19 -17l105 105 l-212 212l389 389l247 -247l-95 -96l18 -18q46 -46 77 -99l29 29q35 35 62.5 88t27.5 96q0 93 -66 159l-141 141q-66 66 -159 66q-95 0 -159 -66l-283 -283q-66 -64 -66 -159z" />
<glyph unicode="&#xe145;" d="M200 100v953q0 21 30 46t81 48t129 38t163 15t162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5zM300 300h600v700h-600v-700zM496 150q0 -43 30.5 -73.5t73.5 -30.5t73.5 30.5t30.5 73.5t-30.5 73.5t-73.5 30.5 t-73.5 -30.5t-30.5 -73.5z" />
<glyph unicode="&#xe146;" d="M0 0l303 380l207 208l-210 212h300l267 279l-35 36q-15 14 -15 35t15 35q14 15 35 15t35 -15l283 -282q15 -15 15 -36t-15 -35q-14 -15 -35 -15t-35 15l-36 35l-279 -267v-300l-212 210l-208 -207z" />
<glyph unicode="&#xe148;" d="M295 433h139q5 -77 48.5 -126.5t117.5 -64.5v335l-27 7q-46 14 -79 26.5t-72 36t-62.5 52t-40 72.5t-16.5 99q0 92 44 159.5t109 101t144 40.5v78h100v-79q38 -4 72.5 -13.5t75.5 -31.5t71 -53.5t51.5 -84t24.5 -118.5h-159q-8 72 -35 109.5t-101 50.5v-307l64 -14 q34 -7 64 -16.5t70 -31.5t67.5 -52t47.5 -80.5t20 -112.5q0 -139 -89 -224t-244 -96v-77h-100v78q-152 17 -237 104q-40 40 -52.5 93.5t-15.5 139.5zM466 889q0 -29 8 -51t16.5 -34t29.5 -22.5t31 -13.5t38 -10q7 -2 11 -3v274q-61 -8 -97.5 -37.5t-36.5 -102.5zM700 237 q170 18 170 151q0 64 -44 99.5t-126 60.5v-311z" />
<glyph unicode="&#xe149;" d="M100 600v100h166q-24 49 -44 104q-10 26 -14.5 55.5t-3 72.5t25 90t68.5 87q97 88 263 88q129 0 230 -89t101 -208h-153q0 52 -34 89.5t-74 51.5t-76 14q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -11 2.5 -24.5t5.5 -24t9.5 -26.5t10.5 -25t14 -27.5t14 -25.5 t15.5 -27t13.5 -24h242v-100h-197q8 -50 -2.5 -115t-31.5 -94q-41 -59 -99 -113q35 11 84 18t70 7q32 1 102 -16t104 -17q76 0 136 30l50 -147q-41 -25 -80.5 -36.5t-59 -13t-61.5 -1.5q-23 0 -128 33t-155 29q-39 -4 -82 -17t-66 -25l-24 -11l-55 145l16.5 11t15.5 10 t13.5 9.5t14.5 12t14.5 14t17.5 18.5q48 55 54 126.5t-30 142.5h-221z" />
<glyph unicode="&#xe150;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM602 900l298 300l298 -300h-198v-900h-200v900h-198z" />
<glyph unicode="&#xe151;" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v200h100v-100h200v-100h-300zM700 400v100h300v-200h-99v-100h-100v100h99v100h-200zM700 700v500h300v-500h-100v100h-100v-100h-100zM801 900h100v200h-100v-200z" />
<glyph unicode="&#xe152;" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v500h300v-500h-100v100h-100v-100h-100zM700 700v200h100v-100h200v-100h-300zM700 1100v100h300v-200h-99v-100h-100v100h99v100h-200zM801 200h100v200h-100v-200z" />
<glyph unicode="&#xe153;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 100v400h300v-500h-100v100h-200zM800 1100v100h200v-500h-100v400h-100zM901 200h100v200h-100v-200z" />
<glyph unicode="&#xe154;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 400v100h200v-500h-100v400h-100zM800 800v400h300v-500h-100v100h-200zM901 900h100v200h-100v-200z" />
<glyph unicode="&#xe155;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h500v-200h-500zM700 400v200h400v-200h-400zM700 700v200h300v-200h-300zM700 1000v200h200v-200h-200z" />
<glyph unicode="&#xe156;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h200v-200h-200zM700 400v200h300v-200h-300zM700 700v200h400v-200h-400zM700 1000v200h500v-200h-500z" />
<glyph unicode="&#xe157;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q162 0 281 -118.5t119 -281.5v-300q0 -165 -118.5 -282.5t-281.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500z" />
<glyph unicode="&#xe158;" d="M0 400v300q0 163 119 281.5t281 118.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-163 0 -281.5 117.5t-118.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM400 300l333 250l-333 250v-500z" />
<glyph unicode="&#xe159;" d="M0 400v300q0 163 117.5 281.5t282.5 118.5h300q163 0 281.5 -119t118.5 -281v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 700l250 -333l250 333h-500z" />
<glyph unicode="&#xe160;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -162 -118.5 -281t-281.5 -119h-300q-165 0 -282.5 118.5t-117.5 281.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 400h500l-250 333z" />
<glyph unicode="&#xe161;" d="M0 400v300h300v200l400 -350l-400 -350v200h-300zM500 0v200h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-500v200h400q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-400z" />
<glyph unicode="&#xe162;" d="M216 519q10 -19 32 -19h302q-155 -438 -160 -458q-5 -21 4 -32l9 -8l9 -1q13 0 26 16l538 630q15 19 6 36q-8 18 -32 16h-300q1 4 78 219.5t79 227.5q2 17 -6 27l-8 8h-9q-16 0 -25 -15q-4 -5 -98.5 -111.5t-228 -257t-209.5 -238.5q-17 -19 -7 -40z" />
<glyph unicode="&#xe163;" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q47 0 100 15v185h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h500v185q-14 4 -114 7.5t-193 5.5l-93 2q-165 0 -282.5 -117.5t-117.5 -282.5v-300zM600 400v300h300v200l400 -350l-400 -350v200h-300z " />
<glyph unicode="&#xe164;" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q163 0 281.5 117.5t118.5 282.5v98l-78 73l-122 -123v-148q0 -41 -29.5 -70.5t-70.5 -29.5h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h156l118 122l-74 78h-100q-165 0 -282.5 -117.5t-117.5 -282.5 v-300zM496 709l353 342l-149 149h500v-500l-149 149l-342 -353z" />
<glyph unicode="&#xe165;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM406 600 q0 80 57 137t137 57t137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137z" />
<glyph unicode="&#xe166;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 800l445 -500l450 500h-295v400h-300v-400h-300zM900 150h100v50h-100v-50z" />
<glyph unicode="&#xe167;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 700h300v-300h300v300h295l-445 500zM900 150h100v50h-100v-50z" />
<glyph unicode="&#xe168;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 705l305 -305l596 596l-154 155l-442 -442l-150 151zM900 150h100v50h-100v-50z" />
<glyph unicode="&#xe169;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 988l97 -98l212 213l-97 97zM200 401h700v699l-250 -239l-149 149l-212 -212l149 -149zM900 150h100v50h-100v-50z" />
<glyph unicode="&#xe170;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM200 612l212 -212l98 97l-213 212zM300 1200l239 -250l-149 -149l212 -212l149 148l248 -237v700h-699zM900 150h100v50h-100v-50z" />
<glyph unicode="&#xe171;" d="M23 415l1177 784v-1079l-475 272l-310 -393v416h-392zM494 210l672 938l-672 -712v-226z" />
<glyph unicode="&#xe172;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-850q0 -21 -15 -35.5t-35 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200z" />
<glyph unicode="&#xe173;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-218l-276 -275l-120 120l-126 -127h-378v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM581 306l123 123l120 -120l353 352l123 -123l-475 -476zM600 1000h100v200h-100v-200z" />
<glyph unicode="&#xe174;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-269l-103 -103l-170 170l-298 -298h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200zM700 133l170 170l-170 170l127 127l170 -170l170 170l127 -128l-170 -169l170 -170 l-127 -127l-170 170l-170 -170z" />
<glyph unicode="&#xe175;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-300h-400v-200h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300l300 -300l300 300h-200v300h-200v-300h-200zM600 1000v200h100v-200h-100z" />
<glyph unicode="&#xe176;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-402l-200 200l-298 -298h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300h200v-300h200v300h200l-300 300zM600 1000v200h100v-200h-100z" />
<glyph unicode="&#xe177;" d="M0 250q0 -21 14.5 -35.5t35.5 -14.5h1100q21 0 35.5 14.5t14.5 35.5v550h-1200v-550zM0 900h1200v150q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 300v200h400v-200h-400z" />
<glyph unicode="&#xe178;" d="M0 400l300 298v-198h400v-200h-400v-198zM100 800v200h100v-200h-100zM300 800v200h100v-200h-100zM500 800v200h400v198l300 -298l-300 -298v198h-400zM800 300v200h100v-200h-100zM1000 300h100v200h-100v-200z" />
<glyph unicode="&#xe179;" d="M100 700v400l50 100l50 -100v-300h100v300l50 100l50 -100v-300h100v300l50 100l50 -100v-400l-100 -203v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447zM800 597q0 -29 10.5 -55.5t25 -43t29 -28.5t25.5 -18l10 -5v-397q0 -21 14.5 -35.5 t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v1106q0 31 -18 40.5t-44 -7.5l-276 -117q-25 -16 -43.5 -50.5t-18.5 -65.5v-359z" />
<glyph unicode="&#xe180;" d="M100 0h400v56q-75 0 -87.5 6t-12.5 44v394h500v-394q0 -38 -12.5 -44t-87.5 -6v-56h400v56q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v888q0 22 25 34.5t50 13.5l25 2v56h-400v-56q75 0 87.5 -6t12.5 -44v-394h-500v394q0 38 12.5 44t87.5 6v56h-400v-56q4 0 11 -0.5 t24 -3t30 -7t24 -15t11 -24.5v-888q0 -22 -25 -34.5t-50 -13.5l-25 -2v-56z" />
<glyph unicode="&#xe181;" d="M0 300q0 -41 29.5 -70.5t70.5 -29.5h300q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-300q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM100 100h400l200 200h105l295 98v-298h-425l-100 -100h-375zM100 300v200h300v-200h-300zM100 600v200h300v-200h-300z M100 1000h400l200 -200v-98l295 98h105v200h-425l-100 100h-375zM700 402v163l400 133v-163z" />
<glyph unicode="&#xe182;" d="M16.5 974.5q0.5 -21.5 16 -90t46.5 -140t104 -177.5t175 -208q103 -103 207.5 -176t180 -103.5t137 -47t92.5 -16.5l31 1l163 162q16 17 13 40.5t-22 37.5l-192 136q-19 14 -45 12t-42 -19l-119 -118q-143 103 -267 227q-126 126 -227 268l118 118q17 17 20 41.5 t-11 44.5l-139 194q-14 19 -36.5 22t-40.5 -14l-162 -162q-1 -11 -0.5 -32.5z" />
<glyph unicode="&#xe183;" d="M0 50v212q0 20 10.5 45.5t24.5 39.5l365 303v50q0 4 1 10.5t12 22.5t30 28.5t60 23t97 10.5t97 -10t60 -23.5t30 -27.5t12 -24l1 -10v-50l365 -303q14 -14 24.5 -39.5t10.5 -45.5v-212q0 -21 -15 -35.5t-35 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5zM0 712 q0 -21 14.5 -33.5t34.5 -8.5l202 33q20 4 34.5 21t14.5 38v146q141 24 300 24t300 -24v-146q0 -21 14.5 -38t34.5 -21l202 -33q20 -4 34.5 8.5t14.5 33.5v200q-6 8 -19 20.5t-63 45t-112 57t-171 45t-235 20.5q-92 0 -175 -10.5t-141.5 -27t-108.5 -36.5t-81.5 -40 t-53.5 -36.5t-31 -27.5l-9 -10v-200z" />
<glyph unicode="&#xe184;" d="M100 0v100h1100v-100h-1100zM175 200h950l-125 150v250l100 100v400h-100v-200h-100v200h-200v-200h-100v200h-200v-200h-100v200h-100v-400l100 -100v-250z" />
<glyph unicode="&#xe185;" d="M100 0h300v400q0 41 -29.5 70.5t-70.5 29.5h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-400zM500 0v1000q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-1000h-300zM900 0v700q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-700h-300z" />
<glyph unicode="&#xe186;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
<glyph unicode="&#xe187;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h100v200h100v-200h100v500h-100v-200h-100v200h-100v-500zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
<glyph unicode="&#xe188;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v100h-200v300h200v100h-300v-500zM600 300h300v100h-200v300h200v100h-300v-500z" />
<glyph unicode="&#xe189;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 550l300 -150v300zM600 400l300 150l-300 150v-300z" />
<glyph unicode="&#xe190;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300v500h700v-500h-700zM300 400h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130v-300zM575 549 q0 -65 27 -107t68 -42h130v300h-130q-38 0 -66.5 -43t-28.5 -108z" />
<glyph unicode="&#xe191;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
<glyph unicode="&#xe192;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v400h-200v100h-100v-500zM301 400v200h100v-200h-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
<glyph unicode="&#xe193;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 700v100h300v-300h-99v-100h-100v100h99v200h-200zM201 300v100h100v-100h-100zM601 300v100h100v-100h-100z M700 700v100h200v-500h-100v400h-100z" />
<glyph unicode="&#xe194;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 500v200 l100 100h300v-100h-300v-200h300v-100h-300z" />
<glyph unicode="&#xe195;" d="M0 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 400v400h300 l100 -100v-100h-100v100h-200v-100h200v-100h-200v-100h-100zM700 400v100h100v-100h-100z" />
<glyph unicode="&#xe197;" d="M-14 494q0 -80 56.5 -137t135.5 -57h222v300h400v-300h128q120 0 205 86t85 208q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200h200v300h200v-300 h200l-300 -300z" />
<glyph unicode="&#xe198;" d="M-14 494q0 -80 56.5 -137t135.5 -57h8l414 414l403 -403q94 26 154.5 104t60.5 178q0 121 -85 207.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200l300 300 l300 -300h-200v-300h-200v300h-200z" />
<glyph unicode="&#xe199;" d="M100 200h400v-155l-75 -45h350l-75 45v155h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170z" />
<glyph unicode="&#xe200;" d="M121 700q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350l-75 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5 t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -12t1 -11q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5z" />
</font>
</defs></svg>

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,157 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="howto/quickstart.html">Quick Start</a></li>
<li><a href="howto/pgloader.1.html">Reference documentation</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Data Sources HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="howto/csv.html">CSV</a></li>
<li><a href="howto/fixed.html">Fixed format</a></li>
<li><a href="howto/geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="howto/dBase.html">dBase</a></li>
<li><a href="howto/sqlite.html">SQLite</a></li>
<li><a href="howto/mysql.html">MySQL</a></li>
</ul>
</li>
<li class="active"><a href="download.html">Download</a></li>
<li><a href="sponsors.html">Sponsors</a></li>
<li><a href="pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Download pgloader</h1>
<p>
You can fetch the source code
from <a href="https://github.com/dimitri/">GitHub</a> or fetch a
self-contained binary image using the following links:
</p>
<table class="table">
<tr><th>File Type</th><th>URL</th></tr>
<tr><td>Repository</td>
<td><a href="https://github.com/dimitri/pgloader">https://github.com/dimitri/pgloader</a></td>
</tr>
<tr><td>Sources</td>
<td><a href="http://pgloader.io/files/pgloader-latest.tgz">pgloader-latest.tgz</a></td>
</tr>
</table>
<p>
Binary build are available on distributions where pgloader is
packaged, which currently includes
only <a href="https://packages.debian.org/sid/pgloader">debian</a>
and <a href="https://wiki.postgresql.org/wiki/Apt">apt.postgresql.org</a>
which covers both <tt>debian</tt> and <tt>ubuntu</tt> Operating
Systems.
</p>
<p>
Note that pgloader is easy enough to build from sources,
see <a href="https://github.com/dimitri/pgloader/blob/master/INSTALL.md">pgloader
INSTALL.md</a> file. For <tt>RPM</tt> based systems, see also
the <a href="https://github.com/dimitri/pgloader/blob/master/bootstrap-centos7.sh">bootstrap-centos7.sh</a>
script that prepares your build environment so that building is
then just a <tt>git clone</tt> then <tt>make</tt> away.
</p>
<p>
Building for the <i>Windows™</i> Operating System is easy enough
and the platform is fully supported. Please report any problem
there as usual, via
the <a href="https://github.com/dimitri/pgloader/issues">pgloader
issues</a> facility hosted at github.
</p>
</div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,163 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Loading CSV Data with pgloader</h1><p>CSV means <em>comma separated values</em> and is often found with quite varying specifications. pgloader allows you to describe those specs in its command. </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.io/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our example for loading CSV data: </p><pre><code> LOAD CSV
FROM 'path/to/file.csv' (x, y, a, b, c, d)
INTO postgresql:///pgloader?csv (a, b, d, c)
WITH truncate,
skip header = 1,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
SET client_encoding to 'latin1',
work_mem to '12MB',
standard_conforming_strings to 'on'
BEFORE LOAD DO
$$ drop table if exists csv; $$,
$$ create table csv (
a bigint,
b bigint,
c char(2),
d text
);
$$; </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><h2>The Data</h2><p>This command allows loading the following CSV file content: </p><pre><code>Header, with a © sign
"2.6.190.56","2.6.190.63","33996344","33996351","GB","United Kingdom"
"3.0.0.0","4.17.135.31","50331648","68257567","US","United States"
"4.17.135.32","4.17.135.63","68257568","68257599","CA","Canada"
"4.17.135.64","4.17.142.255","68257600","68259583","US","United States"
"4.17.143.0","4.17.143.15","68259584","68259599","CA","Canada"
"4.17.143.16","4.18.32.71","68259600","68296775","US","United States" </code></pre><h2>Loading the data</h2><p>Here's how to start loading the data. Note that the ouput here has been edited so as to facilitate its browsing online. </p><pre><code>$ pgloader csv.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/csv.load"
table name read imported errors time
----------------- --------- --------- --------- --------------
before load 2 2 0 0.039s
----------------- --------- --------- --------- --------------
csv 6 6 0 0.019s
----------------- --------- --------- --------- --------------
Total import time 6 6 0 0.058s </code></pre><h2>The result</h2><p>As you can see, the command described above is filtering the input and only importing some of the columns from the example data file. Here's what gets loaded in the PostgreSQL database: </p><pre><code>pgloader# table csv;
a | b | c | d
----------+----------+----+----------------
33996344 | 33996351 | GB | United Kingdom
50331648 | 68257567 | US | United States
68257568 | 68257599 | CA | Canada
68257600 | 68259583 | US | United States
68259584 | 68259599 | CA | Canada
68259600 | 68296775 | US | United States
(6 rows) </code></pre> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,134 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Loading dBase files with pgloader</h1><p>The dBase format is still in use in some places as modern tools such as <em>Filemaker</em> and <em>Excel</em> offer some level of support for it. Speaking of support in modern tools, pgloader is right there on the list too! </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.io/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our example for loading a dBase file, using a file provided by the french administration. </p><p>You can find more files from them at the <a href="http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement.asp">Insee</a> website. </p><p>Here's our command: </p><pre><code>LOAD DBF
FROM http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip
INTO postgresql:///pgloader
WITH truncate, create table
SET client_encoding TO 'latin1'; </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><p>Note that here pgloader will benefit from the meta-data information found in the dBase file to create a PostgreSQL table capable of hosting the data as described, then load the data. </p><h2>Loading the data</h2><p>Let's start the <code>pgloader</code> command with our <code>dbf-zip.load</code> command file: </p><pre><code>$ pgloader dbf-zip.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/dbf-zip.load"
... LOG Fetching 'http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip'
... LOG Extracting files from archive '//private/var/folders/w7/9n8v8pw54t1gngfff0lj16040000gn/T/pgloader//historiq2013.zip'
table name read imported errors time
----------------- --------- --------- --------- --------------
download 0 0 0 0.167s
extract 0 0 0 1.010s
create, truncate 0 0 0 0.071s
----------------- --------- --------- --------- --------------
historiq2013 9181 9181 0 0.658s
----------------- --------- --------- --------- --------------
Total import time 9181 9181 0 1.906s </code></pre><p>We can see that <a href="pgloader">http://pgloader.io</a> did download the file from its HTTP URL location then <em>unziped</em> it before the loading itself. </p><p>Note that the output of the command has been edited to facilitate its browsing online. </p> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,171 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Loading Fixed Width Data File with pgloader</h1><p>Some data providers still use a format where each column is specified with a starting index position and a given length. Usually the columns are blank-padded when the data is shorter than the full reserved range. </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.io/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our example for loading Fixed Width Data, using a file provided by the US census. </p><p>You can find more files from them at the <a href="http://www.census.gov/geo/maps-data/data/gazetteer2000.html">Census 2000 Gazetteer Files</a>. </p><p>Here's our command: </p><pre><code>LOAD ARCHIVE
FROM http://www.census.gov/geo/maps-data/data/docs/gazetteer/places2k.zip
INTO postgresql:///pgloader
BEFORE LOAD DO
$$ drop table if exists places; $$,
$$ create table places
(
usps char(2) not null,
fips char(2) not null,
fips_code char(5),
loc_name varchar(64)
);
$$
LOAD FIXED
FROM FILENAME MATCHING ~/places2k.txt/
WITH ENCODING latin1
(
usps from 0 for 2,
fips from 2 for 2,
fips_code from 4 for 5,
"LocationName" from 9 for 64 [trim right whitespace],
p from 73 for 9,
h from 82 for 9,
land from 91 for 14,
water from 105 for 14,
ldm from 119 for 14,
wtm from 131 for 14,
lat from 143 for 10,
long from 153 for 11
)
INTO postgresql:///pgloader?places
(
usps, fips, fips_code, "LocationName"
); </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><h2>The Data</h2><p>This command allows loading the following file content, where we are only showing the first couple of lines: </p><pre><code>AL0100124Abbeville city 2987 1353 40301945 120383 15.560669 0.046480 31.566367 -85.251300
AL0100460Adamsville city 4965 2042 50779330 14126 19.606010 0.005454 33.590411 -86.949166
AL0100484Addison town 723 339 9101325 0 3.514041 0.000000 34.200042 -87.177851
AL0100676Akron town 521 239 1436797 0 0.554750 0.000000 32.876425 -87.740978
AL0100820Alabaster city 22619 8594 53023800 141711 20.472605 0.054715 33.231162 -86.823829
AL0100988Albertville city 17247 7090 67212867 258738 25.951034 0.099899 34.265362 -86.211261
AL0101132Alexander City city 15008 6855 100534344 433413 38.816529 0.167342 32.933157 -85.936008 </code></pre><h2>Loading the data</h2><p>Let's start the <code>pgloader</code> command with our <code>census-places.load</code> command file: </p><pre><code>$ pgloader census-places.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/census-places.load"
... LOG Fetching 'http://www.census.gov/geo/maps-data/data/docs/gazetteer/places2k.zip'
... LOG Extracting files from archive '//private/var/folders/w7/9n8v8pw54t1gngfff0lj16040000gn/T/pgloader//places2k.zip'
table name read imported errors time
----------------- --------- --------- --------- --------------
download 0 0 0 1.494s
extract 0 0 0 1.013s
before load 2 2 0 0.013s
----------------- --------- --------- --------- --------------
places 25375 25375 0 0.499s
----------------- --------- --------- --------- --------------
Total import time 25375 25375 0 3.019s </code></pre><p>We can see that <a href="pgloader">http://pgloader.io</a> did download the file from its HTTP URL location then <em>unziped</em> it before the loading itself. </p><p>Note that the output of the command has been edited to facilitate its browsing online. </p> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,32 +0,0 @@
</div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,228 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Loading MaxMind Geolite Data with pgloader</h1><p>The <a href="http://www.maxmind.com/">MaxMind</a> provides a free dataset for geolocation, which is quite popular. Using pgloader you can download the lastest version of it, extract the CSV files from the archive and load their content into your database directly. </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.io/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our example for loading the Geolite data: </p><pre><code>/*
* Loading from a ZIP archive containing CSV files. The full test can be
* done with using the archive found at
* http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip
*
* And a very light version of this data set is found at
* http://pgsql.tapoueh.org/temp/foo.zip for quick testing.
*/
LOAD ARCHIVE
FROM http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip
INTO postgresql:///ip4r
BEFORE LOAD DO
$$ create extension if not exists ip4r; $$,
$$ create schema if not exists geolite; $$,
$$ create table if not exists geolite.location
(
locid integer primary key,
country text,
region text,
city text,
postalcode text,
location point,
metrocode text,
areacode text
);
$$,
$$ create table if not exists geolite.blocks
(
iprange ip4r,
locid integer
);
$$,
$$ drop index if exists geolite.blocks_ip4r_idx; $$,
$$ truncate table geolite.blocks, geolite.location cascade; $$
LOAD CSV
FROM FILENAME MATCHING ~/GeoLiteCity-Location.csv/
WITH ENCODING iso-8859-1
(
locId,
country,
region [ null if blanks ],
city [ null if blanks ],
postalCode [ null if blanks ],
latitude,
longitude,
metroCode [ null if blanks ],
areaCode [ null if blanks ]
)
INTO postgresql:///ip4r?geolite.location
(
locid,country,region,city,postalCode,
location point using (format nil "(~a,~a)" longitude latitude),
metroCode,areaCode
)
WITH skip header = 2,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
AND LOAD CSV
FROM FILENAME MATCHING ~/GeoLiteCity-Blocks.csv/
WITH ENCODING iso-8859-1
(
startIpNum, endIpNum, locId
)
INTO postgresql:///ip4r?geolite.blocks
(
iprange ip4r using (ip-range startIpNum endIpNum),
locId
)
WITH skip header = 2,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
FINALLY DO
$$ create index blocks_ip4r_idx on geolite.blocks using gist(iprange); $$; </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><p>Note that while the <em>Geolite</em> data is using a pair of integers (<em>start</em>, <em>end</em>) to represent <em>ipv4</em> data, we use the very poweful <a href="https://github.com/RhodiumToad/ip4r">ip4r</a> PostgreSQL Extension instead. </p><p>The transformation from a pair of integers into an IP is done dynamically by the pgloader process. </p><p>Also, the location is given as a pair of <em>float</em> columns for the <em>longitude</em> and the <em>latitude</em> where PostgreSQL offers the <a href="http://www.postgresql.org/docs/9.3/interactive/functions-geometry.html">point</a> datatype, so the pgloader command here will actually transform the data on the fly to use the appropriate data type and its input representation. </p><h2>Loading the data</h2><p>Here's how to start loading the data. Note that the ouput here has been edited so as to facilitate its browsing online. </p><pre><code>$ pgloader archive.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/archive.load"
... LOG Fetching 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip'
... LOG Extracting files from archive '//private/var/folders/w7/9n8v8pw54t1gngfff0lj16040000gn/T/pgloader//GeoLiteCity-latest.zip'
table name read imported errors time
----------------- --------- --------- --------- --------------
download 0 0 0 11.592s
extract 0 0 0 1.012s
before load 6 6 0 0.019s
----------------- --------- --------- --------- --------------
geolite.location 470387 470387 0 7.743s
geolite.blocks 1903155 1903155 0 16.332s
----------------- --------- --------- --------- --------------
finally 1 1 0 31.692s
----------------- --------- --------- --------- --------------
Total import time 2373542 2373542 0 1m8.390s </code></pre><p>The timing of course includes the transformation of the <em>1.9 million</em> pairs of integer into a single <em>ipv4 range</em> each. The <em>finally</em> step consists of creating the <em>GiST</em> specialized index as given in the main command: </p><pre><code>CREATE INDEX blocks_ip4r_idx ON geolite.blocks USING gist(iprange); </code></pre><p>That index will then be used to speed up queries wanting to find which recorded geolocation contains a specific IP address: </p><pre><code>ip4r&gt; select *
from geolite.location l
join geolite.blocks b using(locid)
where iprange &gt;&gt;= '8.8.8.8';
-[ RECORD 1 ]------------------
locid | 223
country | US
region |
city |
postalcode |
location | (-97,38)
metrocode |
areacode |
iprange | 8.8.8.8-8.8.37.255
Time: 0.747 ms </code></pre> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,84 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">

View File

@ -1,170 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Migrating from MySQL with pgloader</h1><p>If you want to migrate your data over to <a href="http://www.postgresql.org">PostgreSQL</a> from MySQL then pgloader is the tool of choice! </p><p>Most tools around are skipping the main problem with migrating from MySQL, which is to do with the type casting and data sanitizing that needs to be done. pgloader will not leave you alone on those topics. </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.tapoueh.org/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our example for loading the <a href="http://dev.mysql.com/doc/sakila/en/">MySQL Sakila Sample Database</a>: </p><p>Here's our command: </p><pre><code>load database
from mysql://root@localhost/sakila
into postgresql:///sakila
WITH include drop, create tables, no truncate,
create indexes, reset sequences, foreign keys
SET maintenance_work_mem to '128MB', work_mem to '12MB', search_path to 'sakila'
CAST type datetime to timestamptz
drop default drop not null using zero-dates-to-null,
type date drop not null drop default using zero-dates-to-null
MATERIALIZE VIEWS film_list, staff_list
-- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, 'actor'
-- EXCLUDING TABLE NAMES MATCHING ~&lt;ory&gt;
BEFORE LOAD DO
$$ create schema if not exists sakila; $$; </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><p>Note that here pgloader will benefit from the meta-data information found in the MySQL database to create a PostgreSQL database capable of hosting the data as described, then load the data. </p><p>In particular, some specific <em>casting rules</em> are given here, to cope with date values such as <code>0000-00-00</code> that MySQL allows and PostgreSQL rejects for not existing in our calendar. It's possible to add per-column casting rules too, which is useful is some of your <code>tinyint</code> are in fact <code>smallint</code> while some others are in fact <code>boolean</code> values. </p><p>Finaly note that we are using the <em>MATERIALIZE VIEWS</em> clause of pgloader: the selected views here will be migrated over to PostgreSQL <em>with their contents</em>. </p><p>It's possible to use the <em>MATERIALIZE VIEWS</em> clause and give both the name and the SQL (in MySQL dialect) definition of view, then pgloader creates the view before loading the data, then drops it again at the end. </p><h2>Loading the data</h2><p>Let's start the <code>pgloader</code> command with our <code>sakila.load</code> command file: </p><pre><code>$ pgloader sakila.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/sakila.load"
&lt;WARNING: table "xxx" does not exists have been edited away&gt;
table name read imported errors time
---------------------- --------- --------- --------- --------------
before load 1 1 0 0.007s
fetch meta data 45 45 0 0.402s
create, drop 0 36 0 0.208s
---------------------- --------- --------- --------- --------------
actor 200 200 0 0.071s
address 603 603 0 0.035s
category 16 16 0 0.018s
city 600 600 0 0.037s
country 109 109 0 0.023s
customer 599 599 0 0.073s
film 1000 1000 0 0.135s
film_actor 5462 5462 0 0.236s
film_category 1000 1000 0 0.070s
film_text 1000 1000 0 0.080s
inventory 4581 4581 0 0.136s
language 6 6 0 0.036s
payment 16049 16049 0 0.539s
rental 16044 16044 0 0.648s
staff 2 2 0 0.041s
store 2 2 0 0.036s
film_list 997 997 0 0.247s
staff_list 2 2 0 0.135s
Index Build Completion 0 0 0 0.000s
---------------------- --------- --------- --------- --------------
Create Indexes 41 41 0 0.964s
Reset Sequences 0 1 0 0.035s
Foreign Keys 22 22 0 0.254s
---------------------- --------- --------- --------- --------------
Total import time 48272 48272 0 3.502s </code></pre><p>The <em>WARNING</em> messages we see here are expected as the PostgreSQL database is empty when running the command, and pgloader is using the SQL commands <code>DROP TABLE IF EXISTS</code> when the given command uses the <code>include drop</code> option. </p><p>Note that the output of the command has been edited to facilitate its browsing online. </p> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,152 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>pgloader: a quickstart</h1><p>In simple cases, pgloader is very easy to use. </p><h2>CSV</h2><p>Load data from a CSV file into a pre-existing table in your database: </p><pre><code>pgloader --type csv \
--field id --field field \
--with truncate \
--with "fields terminated by ','" \
./test/data/matching-1.csv \
postgres:///pgloader?tablename=matching </code></pre><p>In that example the whole loading is driven from the command line, bypassing the need for writing a command in the pgloader command syntax entirely. As there's no command though, the extra information needed must be provided on the command line using the <code>--type</code> and <code>--field</code> and <code>--with</code> switches. </p><p>For documentation about the available syntaxes for the <code>--field</code> and <code>--with</code> switches, please refer to the CSV section later in the man page. </p><p>Note also that the PostgreSQL URI includes the target <em>tablename</em>. </p><h2>Reading from STDIN</h2><p>File based pgloader sources can be loaded from the standard input, as in the following example: </p><pre><code>pgloader --type csv \
--field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \
--with "skip header = 1" \
--with "fields terminated by '\t'" \
- \
postgresql:///pgloader?districts_longlat \
&lt; test/data/2013_Gaz_113CDs_national.txt </code></pre><p>The dash (<code>-</code>) character as a source is used to mean <em>standard input</em>, as usual in Unix command lines. It's possible to stream compressed content to pgloader with this technique, using the Unix pipe: </p><pre><code>gunzip -c source.gz | pgloader --type csv ... - pgsql:///target?foo </code></pre><h2>Loading from CSV available through HTTP</h2><p>The same command as just above can also be run if the CSV file happens to be found on a remote HTTP location: </p><pre><code>pgloader --type csv \
--field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \
--with "skip header = 1" \
--with "fields terminated by '\t'" \
http://pgsql.tapoueh.org/temp/2013_Gaz_113CDs_national.txt \
postgresql:///pgloader?districts_longlat </code></pre><p>Some more options have to be used in that case, as the file contains a one-line header (most commonly that's column names, could be a copyright notice). Also, in that case, we specify all the fields right into a single <code>--field</code> option argument. </p><p>Again, the PostgreSQL target connection string must contain the <em>tablename</em> option and you have to ensure that the target table exists and may fit the data. Here's the SQL command used in that example in case you want to try it yourself: </p><pre><code>create table districts_longlat
(
usps text,
geoid text,
aland bigint,
awater bigint,
aland_sqmi double precision,
awater_sqmi double precision,
intptlat double precision,
intptlong double precision
); </code></pre><p>Also notice that the same command will work against an archived version of the same data. </p><h2>Streaming CSV data from an HTTP compressed file</h2><p>Finally, it's important to note that pgloader first fetches the content from the HTTP URL it to a local file, then expand the archive when it's recognized to be one, and only then processes the locally expanded file. </p><p>In some cases, either because pgloader has no direct support for your archive format or maybe because expanding the archive is not feasible in your environment, you might want to <em>stream</em> the content straight from its remote location into PostgreSQL. Here's how to do that, using the old battle tested Unix Pipes trick: </p><pre><code>curl http://pgsql.tapoueh.org/temp/2013_Gaz_113CDs_national.txt.gz \
| gunzip -c \
| pgloader --type csv \
--field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong"
--with "skip header = 1" \
--with "fields terminated by '\t'" \
- \
postgresql:///pgloader?districts_longlat </code></pre><p>Now the OS will take care of the streaming and buffering between the network and the commands and pgloader will take care of streaming the data down to PostgreSQL. </p><h2>Migrating from SQLite</h2><p>The following command will open the SQLite database, discover its tables definitions including indexes and foreign keys, migrate those definitions while <em>casting</em> the data type specifications to their PostgreSQL equivalent and then migrate the data over: </p><pre><code>createdb newdb
pgloader ./test/sqlite/sqlite.db postgresql:///newdb </code></pre><h2>Migrating from MySQL</h2><p>Just create a database where to host the MySQL data and definitions and have pgloader do the migration for you in a single command line: </p><pre><code>createdb pagila
pgloader mysql://user@localhost/sakila postgresql:///pagila </code></pre><h2>Fetching an archived DBF file from a HTTP remote location</h2><p>It's possible for pgloader to download a file from HTTP, unarchive it, and only then open it to discover the schema then load the data: </p><pre><code>createdb foo
pgloader --type dbf http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip postgresql:///foo </code></pre><p>Here it's not possible for pgloader to guess the kind of data source it's being given, so it's necessary to use the <code>--type</code> command line switch. </p> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -1,155 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html">Home</a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="pgloader.1.html">Reference documentation</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="csv.html">CSV</a></li>
<li><a href="fixed.html">Fixed format</a></li>
<li><a href="geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="dBase.html">dBase</a></li>
<li><a href="sqlite.html">SQLite</a></li>
<li><a href="mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="../download.html">Download</a></li>
<li><a href="../sponsors.html">Sponsors</a></li>
<li><a href="../pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container">
<div class="row">
<div class="col-md-2"> </div>
<div class="col-md-8">
<h1>Loading SQLite files with pgloader</h1><p>The SQLite database is a respected solution to manage your data with. Its embeded nature makes it a source of migrations when a projects now needs to handle more concurrency, which <a href="http://www.postgresql.org/">PostgreSQL</a> is very good at. pgloader can help you there. </p><h2>The Command</h2><p>To load data with <a href="http://pgloader.io/">pgloader</a> you need to define in a <em>command</em> the operations in some details. Here's our command: </p><pre><code>load database
from 'sqlite/Chinook_Sqlite_AutoIncrementPKs.sqlite'
into postgresql:///pgloader
with include drop, create tables, create indexes, reset sequences
set work_mem to '16MB', maintenance_work_mem to '512 MB'; </code></pre><p>You can see the full list of options in the <a href="pgloader.1.html">pgloader reference manual</a>, with a complete description of the options you see here. </p><p>Note that here pgloader will benefit from the meta-data information found in the SQLite file to create a PostgreSQL database capable of hosting the data as described, then load the data. </p><h2>Loading the data</h2><p>Let's start the <code>pgloader</code> command with our <code>sqlite.load</code> command file: </p><pre><code>$ pgloader sqlite.load
... LOG Starting pgloader, log system is ready.
... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/sqlite.load"
... WARNING Postgres warning: table "album" does not exist, skipping
... WARNING Postgres warning: table "artist" does not exist, skipping
... WARNING Postgres warning: table "customer" does not exist, skipping
... WARNING Postgres warning: table "employee" does not exist, skipping
... WARNING Postgres warning: table "genre" does not exist, skipping
... WARNING Postgres warning: table "invoice" does not exist, skipping
... WARNING Postgres warning: table "invoiceline" does not exist, skipping
... WARNING Postgres warning: table "mediatype" does not exist, skipping
... WARNING Postgres warning: table "playlist" does not exist, skipping
... WARNING Postgres warning: table "playlisttrack" does not exist, skipping
... WARNING Postgres warning: table "track" does not exist, skipping
table name read imported errors time
---------------------- --------- --------- --------- --------------
create, truncate 0 0 0 0.052s
Album 347 347 0 0.070s
Artist 275 275 0 0.014s
Customer 59 59 0 0.014s
Employee 8 8 0 0.012s
Genre 25 25 0 0.018s
Invoice 412 412 0 0.032s
InvoiceLine 2240 2240 0 0.077s
MediaType 5 5 0 0.012s
Playlist 18 18 0 0.008s
PlaylistTrack 8715 8715 0 0.071s
Track 3503 3503 0 0.105s
index build completion 0 0 0 0.000s
---------------------- --------- --------- --------- --------------
Create Indexes 20 20 0 0.279s
reset sequences 0 0 0 0.043s
---------------------- --------- --------- --------- --------------
Total streaming time 15607 15607 0 0.476s </code></pre><p>We can see that <a href="pgloader">http://pgloader.io</a> did download the file from its HTTP URL location then <em>unziped</em> it before loading it. </p><p>Also, the <em>WARNING</em> messages we see here are expected as the PostgreSQL database is empty when running the command, and pgloader is using the SQL commands <code>DROP TABLE IF EXISTS</code> when the given command uses the <code>include drop</code> option. </p><p>Note that the output of the command has been edited to facilitate its browsing online. </p> </div>
<div class="col-md-2"> </div>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

View File

@ -1,171 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
id="svg2"
version="1.1"
inkscape:version="0.47 r22583"
sodipodi:docname="licenses-mit-2.svg">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<inkscape:perspective
id="perspective2884"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective26"
inkscape:persp3d-origin="58.736 : 18.285333 : 1"
inkscape:vp_z="117.472 : 27.427999 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 27.427999 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="66.0436"
inkscape:cy="109.7576"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="876"
inkscape:window-height="684"
inkscape:window-x="7"
inkscape:window-y="299"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-796.36218)">
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:15.34917164;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3685"
sodipodi:cx="132.32999"
sodipodi:cy="134.78169"
sodipodi:rx="113.13708"
sodipodi:ry="109.09647"
d="m 245.46706,134.78169 a 113.13708,109.09647 0 1 1 0,-0.002"
transform="matrix(1.0572285,0,0,1.0930227,-12.041291,777.54782)"
sodipodi:start="0"
sodipodi:end="6.2831679"
sodipodi:open="true" />
<g
id="g4139"
transform="matrix(0.86196383,0,0,1.2200427,15.641523,-202.93929)">
<path
sodipodi:nodetypes="ccscccscssccccsccsccssccc"
d="m 136.58507,970.22141 c 11.91628,-1.36668 22.99865,-12.87097 21.06775,-25.13472 -0.8157,-5.19041 -4.21752,-10.54132 -9.84474,-14.26413 -4.39953,-2.9104 -25.88755,-13.06952 -29.65834,-15.68044 -2.31145,-1.7704 -6.8483,-6.62163 -7.18253,-9.74879 -0.90671,-8.42677 3.69302,-12.0321 8.35563,-14.18801 1.91931,-0.90506 4.40283,-1.23598 5.42205,-1.35511 8.69813,-1.01591 11.52084,0.56422 19.47606,4.33831 0.81902,0.38717 1.63307,0.40703 2.51496,0.26804 2.67545,-0.42026 4.52362,-1.59336 4.10336,-4.26716 -0.31437,-1.98549 -1.41798,-2.89386 -3.48951,-3.92135 -5.54781,-2.74329 -15.6943,-7.04109 -24.70784,-4.65268 -0.14725,0.0215 -0.28955,0.053 -0.43515,0.0761 l -0.0215,-0.12244 c -12.15454,2.0219 -21.7875,13.01327 -19.86819,25.20918 1.03246,6.55544 6.07562,12.04699 11.23129,15.40248 3.4531,2.89551 15.93029,7.91054 28.27841,14.75554 4.37967,2.42892 6.14677,4.82806 6.78874,10.26004 0.6668,5.6355 -5.86217,12.03872 -10.96655,13.97623 -7.93536,2.32634 -17.26057,-0.97289 -23.47517,-4.26054 -1.85479,-1.20784 -2.70689,-1.84651 -4.41442,-1.57681 -2.67215,0.42192 -4.4988,2.93026 -4.08019,5.60406 0.28128,1.77867 1.30546,3.02622 3.04773,3.7956 11.05094,4.86447 18.50316,6.55876 27.85816,5.48659 l -1e-5,10e-6 z"
id="path1557"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:6.24091005;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<g
transform="matrix(1.6545794,0,0,1.6545794,-652.29076,156.18489)"
id="g1577"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
<path
sodipodi:nodetypes="ccccccccc"
d="m 413.564,489.733 c 0,-1.349 1.233,-2.443 2.756,-2.443 l 21.28859,0 c 1.521,0 3.82541,1.095 3.82541,2.443 l 0,0 c 0,1.35 -3.75339,2.67194 -5.27539,2.67194 l -19.83861,0.0763 c -1.522,10e-4 -2.756,-1.39826 -2.756,-2.74826 l 0,0 z"
id="path1579"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="ccccccccc"
d="m 415.632,492.034 c -1.351,0 -2.443,-1.233 -2.443,-2.756 l 0.054,-37.17596 c 0,-1.522 1.03904,-2.70204 2.38904,-2.70204 l 0,0 c 1.35,0 2.60489,1.28696 2.60489,2.80996 l 0.054,37.06804 c 0,1.523 -1.30985,2.756 -2.65885,2.756 l 0,0 z"
id="path1581"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 437.396,461.078 v 4.782 c 5.837,0.09 10.542,4.847 10.542,10.706 0,5.858 -4.705,10.615 -10.542,10.705 v 5.062 c 8.611,-0.021 15.589,-7.009 15.589,-15.627 0,-8.618 -6.977,-15.606 -15.589,-15.628 z"
id="path1583"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 414.475,463.305 c 0,1.37 1.11,2.479 2.479,2.479 h 20.109 c 1.369,0 2.479,-1.108 2.479,-2.479 l 0,0 c 0,-1.368 -1.109,-2.478 -2.479,-2.478 h -20.109 c -1.369,0 -2.479,1.11 -2.479,2.478 l 0,0 z"
id="path1585"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="ccccccccccc"
d="m 425.197,439.932 c 0,1.35 0.685,2.443 1.528,2.443 l 5.25563,-0.054 c 0.844,0 3.21243,0.28204 3.21243,-1.06596 l 0.29052,-2.40133 c 0,-1.351 -3.27876,-1.33677 -4.22968,-1.39074 l -1.86305,-8e-5 c -0.843,-0.001 -4.19385,1.11898 -4.19385,2.46898 l 0,0 0,8e-5 0,5e-5 z"
id="path1587"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 418.189,468.762 c 0,-0.622 0.158,-1.207 0.437,-1.718 0.608,-1.124 1.801,-1.887 3.169,-1.887 h 1.188 v -3.628 h -8.765 v 7.949 h 3.972 v -0.716 z"
id="path1589"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 418.189,457.408 c 0,0.623 0.158,1.209 0.437,1.719 0.608,1.123 1.801,1.887 3.169,1.887 h 1.188 v 3.629 h -8.765 v -7.949 h 3.972 v 0.714 z"
id="path1591"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="m 432.22999,437.53096 0.11801,4.59804 c 5.231,0.018 9.468,4.265 9.468,9.502 0,5.236 -4.236,9.482 -9.468,9.502 l 0,4.651 c 7.801,-0.019 14.12,-6.348 14.12,-14.153 0,-7.807 -6.43801,-14.08304 -14.23801,-14.10004 z"
id="path1593"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:nodetypes="ccsccsc" />
<path
sodipodi:nodetypes="ccscccc"
d="m 431.59204,437.86493 0.054,4.45207 c 5.232,0.02 9.469,4.182 9.469,9.314 0,5.132 -4.236,9.295 -9.469,9.313 l 0,4.561 c 7.802,-0.018 14.12,-6.223 14.12,-13.873 0.001,-7.653 -6.37196,-13.74907 -14.17396,-13.76707 z"
id="path1595"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="cccccccc"
d="m 418.29381,451.951 c 0.219,-4.965 3.77919,-8.988 8.65719,-9.514 l -0.054,-4.76411 c -7.592,0.545 -13.55604,6.71104 -13.56619,14.33107 l 4.909,-0.054 0.054,0.001 -4e-5,0 0,4e-5 z"
id="path1597"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
<g
transform="matrix(1.6545794,0,0,1.6545794,-640.29076,156.18489)"
id="g1599"
style="fill:#990000;fill-opacity:1">
<path
sodipodi:nodetypes="ccccccccc"
d="m 491.271,489.297 c 0,-1.25 0.845,-2.262 1.888,-2.262 l 15.312,0 c 1.042,0 1.888,1.012 1.888,2.262 l 1.14472,0.22894 c 0,1.25 -6.14241,2.03306 -7.18441,2.03306 l -11.31194,0 c -1.045,0 -1.73637,-1.012 -1.73637,-2.262 l 0,0 z"
id="path1601"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="csccccccc"
d="m 495.663,483.516 c 0,0.621 0.158,1.207 0.436,1.719 0.61,1.123 1.801,1.885 3.169,1.885 l 1.188,0 0,3.63 -8.00185,-0.83946 -0.76315,-7.11054 3.972,0 0,0.716 z"
id="path1603"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="ccccsccsccsccsccsc"
d="m 504.799,438.619 c -0.237,-0.029 -0.43,-0.045 -0.558,-0.045 l -4.9,0 0.002,0.028 c -0.041,0 -0.083,-4.8e-4 -0.124,-0.002 -6.18424,-0.22894 -8.063,3.386 -8.464,7.709 l 0,42.492 c 0,1.522 1.094,2.45174 2.443,2.45174 1.349,0 2.442,-0.92874 2.442,-2.45174 l 0,-42.214 c 0.006,-0.611 0.161,-1.186 0.435,-1.688 0.491,-0.905 1.36,-1.575 2.395,-1.802 l 8.113,0 c 11.066,1.392 19.619,10.707 19.619,21.992 0,12.037 -9.731,21.834 -21.861,22.164 l 0,4.01674 c 14.552,-0.33 26.246,-11.75674 26.246,-26.18074 0,-14.271 -11.449,-25.905 -25.788,-26.47 z"
id="path1605"
style="fill:#990000;fill-opacity:1;stroke:#990000;stroke-width:3.77190137;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

View File

@ -1,213 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="howto/quickstart.html">Quick Start</a></li>
<li><a href="howto/pgloader.1.html">Reference documentation</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Advanced HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="howto/csv.html">CSV</a></li>
<li><a href="howto/fixed.html">Fixed format</a></li>
<li><a href="howto/geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="howto/dBase.html">dBase</a></li>
<li><a href="howto/sqlite.html">SQLite</a></li>
<li><a href="howto/mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="download.html">Download</a></li>
<li><a href="sponsors.html">Sponsors</a></li>
<li><a href="pgloader-moral-license.html">License</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img data-src="holder.js/900x400/auto/#777:#7a7a7a">
<div class="container">
<div class="carousel-caption">
<h1>Load data into PostgreSQL. Fast.</h1>
<p>Pgloader loads data into PostgreSQL using the
COPY <b><i>streaming</i></b> protocol, and doing so with
separate threads for reading and writing data. Asynchronous
IO, compiled to the metal programming language.</p>
</div>
</div>
</div>
<div class="item">
<img data-src="holder.js/900x400/auto/#666:#6a6a6a">
<div class="container">
<div class="carousel-caption">
<h1>Load data into PostgreSQL. Any Data.</h1>
<p>pgloader knows how to read data from MySQL, SQLite or dBase
databases, and knows how to discover the schema and properly
cast data types over. It also knows how to read CSV files in
several definitions of CSV, and fixed columns files.</p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.carousel -->
<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->
<div class="row">
<div class="col-md-3"> </div>
<div class="col-md-6">
<h2>Why did pgloader get so much faster?</h2>
<video id="pg-lt" width="100%" controls data-title="Lightning Talks">
<source src="http://medias.ircam.fr/stream/ext/video/files/2014/05/13/ELSAA_6_mai2.mov.webm#t=57,357" type="video/webm" />
<source src="http://medias.ircam.fr/stream/ext/video/files/2014/05/13/ELSAA_6_mai2.mov.mp4#t=57,357" type="video/mp4" />
<source src="http://medias.ircam.fr/stream/ext/video/files/2014/05/13/ELSAA_6_mai2.mov.ogg#t=57,357" type="video/ogg" />
</video>
</div>
</div>
<div class="container marketing">
<!-- START THE FEATURETTES -->
<!-- <hr class="featurette-divider"> -->
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">Migrate from MySQL to PostgreSQL. <span class="text-muted">In one command.</span></h2>
<p class="lead">Given a MySQL connection string, pgloader query
the catalogs to list your tables, constraints and indexes and know
how to transform this schema into a PostgreSQL equivalent,
applying advanced casting rules that you can edit in the
command.</p>
<p>Migrate some <i>tinyint<i> to <tt>boolean</tt> and some others
to <tt>smallint</tt> all from the same tool!</p>
<p><a class="btn btn-default" href="howto/mysql.html" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive" src="img/type-casting-machine.500.jpg" alt="MySQL to PostgreSQL with Custom Type Casting">
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-5">
<img class="featurette-image img-responsive" src="img/csv_text.png" alt="CSV data format">
</div>
<div class="col-md-7">
<h2 class="featurette-heading">Load any CSV file. <span class="text-muted">Real quick.</span></h2>
<p class="lead">The current version of pgloader is up to <b><i>ten
times faster</i></b> than the previous one. The new command syntax
is really powerful, and as it's different enough from the previous
version, pgloader includes a command line switch to upgrade your
setup for you.</p>
<p><a class="btn btn-default" href="howto/csv.html" role="button">View details &raquo;</a></p>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">Transform your data. <span class="text-muted">While streaming.</span></h2>
<p class="lead">pgloader includes reformating modules allowing you
to reformat your data, such as transforming a couple of integer
columns into a single <i>ip address</i>, or a couple of floats
into a single <i>point</i>. Of course, you can add any
transformation you like and easily get to use it with
pgloader loading your code!</p>
<p><a class="btn btn-default" href="howto/geolite.html" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive" src="img/huge-full-outer-join.gif" alt="Transform Data">
</div>
</div>
<hr class="featurette-divider">
<!-- /END THE FEATURETTES -->
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

296
docs/index.rst Normal file
View File

@ -0,0 +1,296 @@
.. pgloader documentation master file, created by
sphinx-quickstart on Tue Dec 5 19:23:32 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to pgloader's documentation!
====================================
The `pgloader`__ project is an Open Source Software project. The development
happens at `https://github.com/dimitri/pgloader`__ and is public: everyone
is welcome to participate by opening issues, pull requests, giving feedback,
etc.
__ https://github.com/dimitri/pgloader
__ https://github.com/dimitri/pgloader
pgloader loads data from various sources into PostgreSQL. It can transform
the data it reads on the fly and submit raw SQL before and after the
loading. It uses the `COPY` PostgreSQL protocol to stream the data into the
server, and manages errors by filling a pair of *reject.dat* and
*reject.log* files.
Thanks to being able to load data directly from a database source, pgloader
also supports from migrations from other productions to PostgreSQL. In this
mode of operations, pgloader handles both the schema and data parts of the
migration, in a single unmanned command, allowing to implement **Continuous
Migration**.
Features Overview
=================
pgloader has two modes of operation: loading from files, migrating
databases. In both cases, pgloader uses the PostgreSQL COPY protocol which
implements a **streaming** to send data in a very efficient way.
Loading file content in PostgreSQL
----------------------------------
When loading from files, pgloader implements the following features:
Many source formats supported
Support for a wide variety of file based formats are included in
pgloader: the CSV family, fixed columns formats, dBase files (``db3``),
and IBM IXF files.
The SQLite database engine is accounted for in the next section:
pgloader considers SQLite as a database source and implements schema
discovery from SQLite catalogs.
On the fly data transformation
Often enough the data as read from a CSV file (or another format) needs
some tweaking and clean-up before being sent to PostgreSQL.
For instance in the `geolite
<https://github.com/dimitri/pgloader/blob/master/test/archive.load>`_
example we can see that integer values are being rewritten as IP address
ranges, allowing to target an ``ip4r`` column directly.
Full Field projections
pgloader supports loading data into less fields than found on file, or
more, doing some computation on the data read before sending it to
PostgreSQL.
Reading files from an archive
Archive formats *zip*, *tar*, and *gzip* are supported by pgloader: the
archive is extracted in a temporary directly and expanded files are then
loaded.
HTTP(S) support
pgloader knows how to download a source file or a source archive using
HTTP directly. It might be better to use ``curl -O- http://... |
pgloader`` and read the data from *standard input*, then allowing for
streaming of the data from its source down to PostgreSQL.
Target schema discovery
When loading in an existing table, pgloader takes into account the
existing columns and may automatically guess the CSV format for you.
On error stop / On error resume next
In some cases the source data is so damaged as to be impossible to
migrate in full, and when loading from a file then the default for
pgloader is to use ``on error resume next`` option, where the rows
rejected by PostgreSQL are saved away and the migration continues with
the other rows.
In other cases loading only a part of the input data might not be a
great idea, and in such cases it's possible to use the ``on error stop``
option.
Pre/Post SQL commands
This feature allows pgloader commands to include SQL commands to run
before and after loading a file. It might be about creating a table
first, then loading the data into it, and then doing more processing
on-top of the data (implementing an *ELT* pipeline then), or creating
specific indexes as soon as the data has been made ready.
One-command migration to PostgreSQL
-----------------------------------
When migrating a full database in a single command, pgloader implements the
following features:
One-command migration
The whole migration is started with a single command line and then runs
unattended. pgloader is meant to be integrated in a fully automated
tooling that you can repeat as many times as needed.
Schema discovery
The source database is introspected using its SQL catalogs to get the
list of tables, attributes (with data types, default values, not null
constraints, etc), primary key constraints, foreign key constraints,
indexes, comments, etc. This feeds an internal database catalog of all
the objects to migrate from the source database to the target database.
User defined casting rules
Some source database have ideas about their data types that might not be
compatible with PostgreSQL implementaion of equivalent data types.
For instance, SQLite since version 3 has a `Dynamic Type System
<https://www.sqlite.org/datatype3.html>`_ which of course isn't
compatible with the idea of a `Relation
<https://en.wikipedia.org/wiki/Relation_(database)>`_. Or MySQL accepts
datetime for year zero, which doesn't exists in our calendar, and
doesn't have a boolean data type.
When migrating from another source database technology to PostgreSQL,
data type casting choices must be made. pgloader implements solid
defaults that you can rely upon, and a facility for **user defined data
type casting rules** for specific cases. The idea is to allow users to
specify the how the migration should be done, in order for it to be
repeatable and included in a *Continuous Migration* process.
On the fly data transformations
The user defined casting rules come with on the fly rewrite of the data.
For instance zero dates (it's not just the year, MySQL accepts
``0000-00-00`` as a valid datetime) are rewritten to NULL values by
default.
Partial Migrations
It is possible to include only a partial list of the source database
tables in the migration, or to exclude some of the tables on the source
database.
Schema only, Data only
This is the **ORM compatibility** feature of pgloader, where it is
possible to create the schema using your ORM and then have pgloader
migrate the data targeting this already created schema.
When doing this, it is possible for pgloader to *reindex* the target
schema: before loading the data from the source database into PostgreSQL
using COPY, pgloader DROPs the indexes and constraints, and reinstalls
the exact same definitions of them once the data has been loaded.
The reason for operating that way is of course data load performance.
Repeatable (DROP+CREATE)
By default, pgloader issues DROP statements in the target PostgreSQL
database before issuing any CREATE statement, so that you can repeat the
migration as many times as necessary until migration specifications and
rules are bug free.
The schedule the data migration to run every night (or even more often!)
for the whole duration of the code migration project. See the
`Continuous Migration <https://pgloader.io/blog/continuous-migration/>`_
methodology for more details about the approach.
On error stop / On error resume next
The default behavior of pgloader when migrating from a database is
``on error stop``. The idea is to let the user fix either the migration
specifications or the source data, and run the process again, until
it works.
In some cases the source data is so damaged as to be impossible to
migrate in full, and it might be necessary to then resort to the ``on
error resume next`` option, where the rows rejected by PostgreSQL are
saved away and the migration continues with the other rows.
Pre/Post SQL commands, Post-Schema SQL commands
While pgloader takes care of rewriting the schema to PostgreSQL
expectations, and even provides *user-defined data type casting rules*
support to that end, sometimes it is necessary to add some specific SQL
commands around the migration. It's of course supported right from
pgloader itself, without having to script around it.
Online ALTER schema
At times migrating to PostgreSQL is also a good opportunity to review
and fix bad decisions that were made in the past, or simply that are not
relevant to PostgreSQL.
The pgloader command syntax allows to ALTER pgloader's internal
representation of the target catalogs so that the target schema can be
created a little different from the source one. Changes supported
include target a different *schema* or *table* name.
Materialized Views, or schema rewrite on-the-fly
In some cases the schema rewriting goes deeper than just renaming the
SQL objects to being a full normalization exercise. Because PostgreSQL
is great at running a normalized schema in production under most
workloads.
pgloader implements full flexibility in on-the-fly schema rewriting, by
making it possible to migrate from a view definition. The view attribute
list becomes a table definition in PostgreSQL, and the data is fetched
by querying the view on the source system.
A SQL view allows to implement both content filtering at the column
level using the SELECT projection clause, and at the row level using the
WHERE restriction clause. And backfilling from reference tables thanks
to JOINs.
Distribute to Citus
When migrating from PostgreSQL to Citus, a important part of the process
consists of adjusting the schema to the distribution key. Read
`Preparing Tables and Ingesting Data
<https://docs.citusdata.com/en/v8.0/use_cases/multi_tenant.html>`_ in
the Citus documentation for a complete example showing how to do that.
When using pgloader it's possible to specify the distribution keys and
reference tables and let pgloader take care of adjusting the table,
indexes, primary keys and foreign key definitions all by itself.
Encoding Overrides
MySQL doesn't actually enforce the encoding of the data in the database
to match the encoding known in the metadata, defined at the database,
table, or attribute level. Sometimes, it's necessary to override the
metadata in order to make sense of the text, and pgloader makes it easy
to do so.
Continuous Migration
--------------------
pgloader is meant to migrate a whole database in a single command line and
without any manual intervention. The goal is to be able to setup a
*Continuous Integration* environment as described in the `Project
Methodology <http://mysqltopgsql.com/project/>`_ document of the `MySQL to
PostgreSQL <http://mysqltopgsql.com/project/>`_ webpage.
1. Setup your target PostgreSQL Architecture
2. Fork a Continuous Integration environment that uses PostgreSQL
3. Migrate the data over and over again every night, from production
4. As soon as the CI is all green using PostgreSQL, schedule the D-Day
5. Migrate without suprise and enjoy!
In order to be able to follow this great methodology, you need tooling to
implement the third step in a fully automated way. That's pgloader.
.. toctree::
:hidden:
:caption: Getting Started
intro
quickstart
tutorial/tutorial
install
bugreport
.. toctree::
:hidden:
:caption: Reference Manual
pgloader
command
batches
ref/transforms
.. toctree::
:hidden:
:caption: Manual for file formats
ref/csv
ref/fixed
ref/copy
ref/dbf
ref/ixf
ref/archive
.. toctree::
:maxdepth: 2
:hidden:
:caption: Manual for Database Servers
ref/mysql
ref/sqlite
ref/mssql
ref/pgsql
ref/pgsql-citus-target
ref/pgsql-redshift
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

221
docs/install.rst Normal file
View File

@ -0,0 +1,221 @@
Installing pgloader
===================
Several distributions are available for pgcopydb.
debian packages
---------------
You can install pgloader directly from `apt.postgresql.org`__ and from
official debian repositories, see `packages.debian.org/pgloader`__.
::
$ apt-get install pgloader
__ https://wiki.postgresql.org/wiki/Apt
__ https://packages.debian.org/search?keywords=pgloader
RPM packages
------------
The Postgres community repository for RPM packages is `yum.postgresql.org`__
and does include binary packages for pgloader.
__ https://yum.postgresql.org
Docker Images
-------------
Docker images are maintained for each tagged release at dockerhub, and also
built from the CI/CD integration on GitHub at each commit to the `main`
branch.
The DockerHub `dimitri/pgloader`__ repository is where the tagged releases
are made available. The image uses the Postgres version currently in debian
stable.
__ https://hub.docker.com/r/dimitri/pgloader
To use the ``dimitri/pgloader`` docker image::
$ docker run --rm -it dimitri/pgloader:latest pgloader --version
Or you can use the CI/CD integration that publishes packages from the main
branch to the GitHub docker repository::
$ docker pull ghcr.io/dimitri/pgloader:latest
$ docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader --version
$ docker run --rm -it ghcr.io/dimitri/pgloader:latest pgloader --help
Build from sources
------------------
pgloader is a Common Lisp program, tested using the `SBCL`__ (>= 1.2.5) and
`Clozure CL`__ implementations and with `Quicklisp`__ to fetch build
dependencies.
__ http://sbcl.org/
__ http://ccl.clozure.com/
__ http://www.quicklisp.org/beta/
When building from sources, you should always build from the current git
HEAD as it's basically the only source that is managed in a way to ensure it
builds against current set of dependencies versions.
The build system for pgloader uses a Makefile and the Quicklisp Common Lisp
packages distribution system.
The modern build system for pgloader is entirely written in Common Lisp,
where the historical name for our operation is `save-lisp-and-die` and can
be used that way:
::
$ make save
The legacy build system also uses Buildapp and can be used that way:
::
$ make pgloader
Building from sources on debian
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Install the build dependencies first, then use the Makefile::
$ apt-get install sbcl unzip libsqlite3-dev make curl gawk freetds-dev libzip-dev
$ cd /path/to/pgloader
$ make save
$ ./build/bin/pgloader --help
Building from sources on RedHat/CentOS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To build and install pgloader the Steel Bank Common Lisp package (sbcl) from
EPEL, and the freetds packages are required.
It is recommended to build the RPM yourself, see below, to ensure that all
installed files are properly tracked and that you can safely update to newer
versions of pgloader as they're released.
To do an adhoc build and install run ``boostrap-centos.sh`` for CentOS 6 or
``bootstrap-centos7.sh`` for CentOS 7 to install the required dependencies.
Building a pgloader RPM from sources
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The spec file in the root of the pgloader repository can be used to build your
own RPM. For production deployments it is recommended that you build this RPM on
a dedicated build box and then copy the RPM to your production environment for
use; it is considered bad practice to have compilers and build tools present in
production environments.
1. Install the [EPEL repo](https://fedoraproject.org/wiki/EPEL#Quickstart).
2. Install rpmbuild dependencies::
sudo yum -y install yum-utils rpmdevtools @"Development Tools"
3. Install pgloader build dependencies::
sudo yum-builddep pgloader.spec
4. Download pgloader source::
spectool -g -R pgloader.spec
5. Build the source and binary RPMs (see `rpmbuild --help` for other build
options)::
rpmbuild -ba pgloader.spec
Building from sources on macOS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We suppose you already have ``git`` and ``make`` available, if that's not
the case now is the time to install those tools. The SQLite lib that comes
in MacOSX is fine, no need for extra software here.
You will need to install either SBCL or CCL separately, and when using
[brew](http://brew.sh/) it's as simple as:
::
$ brew install sbcl
$ brew install clozure-cl
NOTE: Make sure you installed the universal binaries of Freetds, so that
they can be loaded correctly.
::
$ brew install freetds --universal --build-from-source
Then use the normal build system for pgloader:
::
$ make save
$ ./build/bin/pgloader --version
Building from sources on Windows
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Building pgloader on Windows is supported (in theory), thanks to Common Lisp
implementations being available on that platform, and to the Common Lisp
Standard for making it easy to write actually portable code.
It is recommended to have a look at the `issues labelled with Windows
support`__ if you run into trouble when building pgloader, because the
development team is lacking windows user and in practice we can't maintain
the support for that Operating System:
__ https://github.com/dimitri/pgloader/issues?utf8=✓&q=label%3A%22Windows%20support%22%20>
If you need ``pgloader.exe`` on windows please condider contributing fixes
for that environment and maybe longer term support then. Specifically, a CI
integration with a windows build host would allow ensuring that we continue
to support that target.
Building Docker image from sources
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can build a Docker image from source using SBCL by default::
$ docker build .
Or Clozure CL (CCL)::
$ docker build -f Dockerfile.ccl .
More options when building from source
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The ``Makefile`` target ``save`` knows how to produce a Self Contained
Binary file for pgloader, found at ``./build/bin/pgloader``::
$ make save
By default, the ``Makefile`` uses `SBCL`__ to compile your binary image,
though it's possible to build using `Clozure-CL`__.
__ http://sbcl.org/
__ http://ccl.clozure.com/
::
$ make CL=ccl64 save
It is possible to to tweak the default amount of memory that the pgloader
image will allow itself using when running through your data (don't ask for
more than your current RAM tho). At the moment only the legacy build system
includes support for this custom build::
$ make DYNSIZE=8192 pgloader
The ``make pgloader`` command when successful outputs a
`./build/bin/pgloader` file for you to use.

100
docs/intro.rst Normal file
View File

@ -0,0 +1,100 @@
Introduction
============
pgloader loads data from various sources into PostgreSQL. It can
transform the data it reads on the fly and submit raw SQL before and
after the loading. It uses the `COPY` PostgreSQL protocol to stream
the data into the server, and manages errors by filling a pair of
*reject.dat* and *reject.log* files.
pgloader knows how to read data from different kind of sources:
* Files
* CSV
* Fixed Format
* Postgres COPY text format
* DBF
* IXF
* Databases
* SQLite
* MySQL
* MS SQL Server
* PostgreSQL
* Redshift
pgloader knows how to target different products using the PostgreSQL Protocol:
* PostgreSQL
* `Citus <https://www.citusdata.com>`_
* Redshift
The level of automation provided by pgloader depends on the data source
type. In the case of CSV and Fixed Format files, a full description of the
expected input properties must be given to pgloader. In the case of a
database, pgloader connects to the live service and knows how to fetch the
metadata it needs directly from it.
Features Matrix
---------------
Here's a comparison of the features supported depending on the source
database engine. Some features that are not supported can be added to
pgloader, it's just that nobody had the need to do so yet. Those features
are marked with ✗. Empty cells are used when the feature doesn't make sense
for the selected source database.
========================== ======= ====== ====== =========== =========
Feature SQLite MySQL MS SQL PostgreSQL Redshift
========================== ======= ====== ====== =========== =========
One-command migration ✓ ✓ ✓ ✓ ✓
Continuous Migration ✓ ✓ ✓ ✓ ✓
Schema discovery ✓ ✓ ✓ ✓ ✓
Partial Migrations ✓ ✓ ✓ ✓ ✓
Schema only ✓ ✓ ✓ ✓ ✓
Data only ✓ ✓ ✓ ✓ ✓
Repeatable (DROP+CREATE) ✓ ✓ ✓ ✓ ✓
User defined casting rules ✓ ✓ ✓ ✓ ✓
Encoding Overrides ✓
On error stop ✓ ✓ ✓ ✓ ✓
On error resume next ✓ ✓ ✓ ✓ ✓
Pre/Post SQL commands ✓ ✓ ✓ ✓ ✓
Post-Schema SQL commands ✗ ✓ ✓ ✓ ✓
Primary key support ✓ ✓ ✓ ✓ ✓
Foreign key support ✓ ✓ ✓ ✓
Online ALTER schema ✓ ✓ ✓ ✓ ✓
Materialized views ✗ ✓ ✓ ✓ ✓
Distribute to Citus ✗ ✓ ✓ ✓ ✓
========================== ======= ====== ====== =========== =========
For more details about what the features are about, see the specific
reference pages for your database source.
For some of the features, missing support only means that the feature is not
needed for the other sources, such as the capability to override MySQL
encoding metadata about a table or a column. Only MySQL in this list is left
completely unable to guarantee text encoding. Or Redshift not having foreign
keys.
Commands
--------
pgloader implements its own *Command Language*, a DSL that allows to specify
every aspect of the data load and migration to implement. Some of the
features provided in the language are only available for a specific source
type.
Command Line
------------
The pgloader command line accepts those two variants::
pgloader [<options>] [<command-file>]...
pgloader [<options>] SOURCE TARGET
Either you have a *command-file* containing migration specifications in the
pgloader *Command Language*, or you can give a *Source* for the data and a
PostgreSQL database connection *Target* where to load the data into.

View File

@ -1,171 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>pgloader</title>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="dist/carousel.css" rel="stylesheet">
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">pgloader</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="howto/quickstart.html">Quick Start</a></li>
<li><a href="howto/pgloader.1.html">Reference documentation</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Data Sources HowTos <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Plain Files</li>
<li><a href="howto/csv.html">CSV</a></li>
<li><a href="howto/fixed.html">Fixed format</a></li>
<li><a href="howto/geolite.html">Geolite</a></li>
<li class="divider"></li>
<li class="dropdown-header">Databases</li>
<li><a href="howto/dBase.html">dBase</a></li>
<li><a href="howto/sqlite.html">SQLite</a></li>
<li><a href="howto/mysql.html">MySQL</a></li>
</ul>
</li>
<li><a href="download.html">Download</a></li>
<li><a href="sponsors.html">Sponsors</a></li>
<li class="active">
<a href="pgloader-moral-license.html">License</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- an empty carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="height: 100px">
<div class="carousel-inner" style="height: 100px">
<div class="item active" style="height: 100px">
<img data-src="holder.js/900x100/auto/#777:#7a7a7a" style="height: 100px">
<!-- <div class="container"> -->
<!-- <div class="carousel-caption"> -->
<!-- <h1>Load data into PostgreSQL. Fast.</h1> -->
<!-- <p></p> -->
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</div><!-- /.carousel -->
<div class="container marketing">
<div class="row featurette">
<div class="col-md-8 col-md-offset-2">
<h2 class="featurette-heading" style="text-align: center;">
pgloader <span class="text-muted"> Moral License </span>
</h2>
<p class="lead" style="text-align: justify; padding-top: 1em;">
The pgloader project is fully Open Source and released
under <a href="http://www.postgresql.org/about/licence/">The
PostgreSQL License</a> so that anyone can easily contribute to
the project. The whole project management (issue tracking,
feature proposals, etc) happens on
the <a href="https://github.com/dimitri/pgloader">pgloader
github page</a>, in public.
</p>
<a href="http://www.postgresql.org/about/licence/">
<img class="featurette-image img-responsive center-block"
src="img/bsd.svg"
alt="BSD">
</a>
<hr />
<p class="lead" style="text-align: justify; padding-top: 1em;">
Software development may be open, and the result shared with an
Open Source Software licence, but the actual hours of
programming are not gratis.
</p>
<p class="lead" style="text-align: justify; padding-top: 1em;">
Just like everybody else, I need money for mortgage, kids and
food, money I make by doing things with computers, for people
who are willing to pay for that.
One of the things I do for money, is develop pgloader, and the
<i>pgloader Moral License</i> is a good vehicle available for
the paperwork. I shamelessly stole the whole idea
from <a href="http://phk.freebsd.dk/VML/">The Varnish Moral
License</a>. See
the <a href="http://phk.freebsd.dk/VML/vmlfaq.html">Varnish
Moral License FAQ and How To</a> to see how PHK does it.
</p>
<h3 style="text-align: center;">The way it works is very simple:</h3>
<p class="lead" style="text-align: justify; padding-top: 1em;">
Happy pgloader users tell me that they want a <b><i>pgloader
Moral License</i></b>. I send them an invoice from my company.
They <i>pay the invoice</i>, I develop pgloader.
</p>
<hr />
<h3 style="text-align: center;">
Interested?
<span class="text-muted">
Email me at
<a href="mailto:dim@tapoueh.org">dim@tapoueh.org</a>
</span>
</h3>
<hr />
<p class="lead" style="text-align: justify; padding-top: 1em;">
If you or your company prefer more classic paperwork (as known
as <i>contracting</i> or <i>sponsoring</i>), of course that is
still possible too, just get in touch!
</p>
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2014 Dimitri Fontaine. &middot;</p>
</footer>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
<!-- <script src="docs-assets/js/holder.js"></script> -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47059482-2', 'tapoueh.org');
ga('send', 'pageview');
</script>
</body>
</html>

235
docs/pgloader.rst Normal file
View File

@ -0,0 +1,235 @@
Command Line
============
pgloader loads data from various sources into PostgreSQL. It can
transform the data it reads on the fly and submit raw SQL before and
after the loading. It uses the `COPY` PostgreSQL protocol to stream
the data into the server, and manages errors by filling a pair of
*reject.dat* and *reject.log* files.
pgloader operates either using commands which are read from files::
pgloader commands.load
or by using arguments and options all provided on the command line::
pgloader SOURCE TARGET
Arguments
---------
The pgloader arguments can be as many load files as needed, or a couple of
connection strings to a specific input file.
Source Connection String
^^^^^^^^^^^^^^^^^^^^^^^^
The source connection string format is as follows::
format:///absolute/path/to/file.ext
format://./relative/path/to/file.ext
Where format might be one of `csv`, `fixed`, `copy`, `dbf`, `db3` or `ixf`.::
db://user:pass@host:port/dbname
Where db might be of `sqlite`, `mysql` or `mssql`.
When using a file based source format, pgloader also support natively
fetching the file from an http location and decompressing an archive if
needed. In that case it's necessary to use the `--type` option to specify
the expected format of the file. See the examples below.
Also note that some file formats require describing some implementation
details such as columns to be read and delimiters and quoting when loading
from csv.
For more complex loading scenarios, you will need to write a full fledge
load command in the syntax described later in this document.
Target Connection String
^^^^^^^^^^^^^^^^^^^^^^^^
The target connection string format is described in details later in this
document, see Section Connection String.
Options
-------
Inquiry Options
^^^^^^^^^^^^^^^
Use these options when you want to know more about how to use pgloader, as
those options will cause pgloader not to load any data.
--help
Show command usage summary and exit.
--version
Show pgloader version string and exit.
--with-encodings
List known encodings in this version of pgloader.
--upgrade-config
Parse given files in the command line as ``pgloader.conf`` files with
the INI syntax that was in use in pgloader versions 2.x, and output the
new command syntax for pgloader on standard output.
General Options
^^^^^^^^^^^^^^^
Those options are meant to tweak pgloader behavior when loading data.
--verbose
Be verbose.
--quiet
Be quiet.
--debug
Show debug level information messages.
--root-dir
Set the root working directory (defaults to ``/tmp/pgloader``).
--logfile
Set the pgloader log file (defaults to ``/tmp/pgloader/pgloader.log``).
--log-min-messages
Minimum level of verbosity needed for log message to make it to the
logfile. One of critical, log, error, warning, notice, info or debug.
--client-min-messages
Minimum level of verbosity needed for log message to make it to the
console. One of critical, log, error, warning, notice, info or debug.
--summary
A filename where to copy the summary output. When relative, the filename
is expanded into ``*root-dir*``.
The format of the filename defaults to being *human readable*. It is
possible to have the output in machine friendly formats such as *CSV*,
*COPY* (PostgreSQL's own COPY format) or *JSON* by specifying a filename
with the extension resp. ``.csv``, ``.copy`` or ``.json``.
--load-lisp-file <file>
Specify a lisp <file> to compile and load into the pgloader image before
reading the commands, allowing to define extra transformation function.
Those functions should be defined in the ``pgloader.transforms``
package. This option can appear more than once in the command line.
--dry-run
Allow testing a ``.load`` file without actually trying to load any data.
It's useful to debug it until it's ok, in particular to fix connection
strings.
--on-error-stop
Alter pgloader behavior: rather than trying to be smart about error
handling and continue loading good data, separating away the bad one,
just stop as soon as PostgreSQL refuses anything sent to it. Useful to
debug data processing, transformation function and specific type
casting.
--self-upgrade <directory>
Specify a <directory> where to find pgloader sources so that one of the
very first things it does is dynamically loading-in (and compiling to
machine code) another version of itself, usually a newer one like a very
recent git checkout.
--no-ssl-cert-verification
Uses the OpenSSL option to accept a locally issued server-side
certificate, avoiding the following error message::
SSL verify error: 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
The right way to fix the SSL issue is to use a trusted certificate, of
course. Sometimes though it's useful to make progress with the pgloader
setup while the certificate chain of trust is being fixed, maybe by
another team. That's when this option is useful.
Command Line Only Operations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Those options are meant to be used when using pgloader from the command line
only, rather than using a command file and the rich command clauses and
parser. In simple cases, it can be much easier to use the *SOURCE* and
*TARGET* directly on the command line, then tweak the loading with those
options:
--with <option>
Allows setting options from the command line. You can use that option as
many times as you want. The option arguments must follow the *WITH*
clause for the source type of the ``SOURCE`` specification, as described
later in this document.
--set
Allows setting PostgreSQL configuration from the command line. Note that
the option parsing is the same as when used from the *SET* command
clause, in particular you must enclose the guc value with single-quotes.
Use ``--set "guc_name='value'"``.
--field
Allows setting a source field definition. Fields are accumulated in the
order given on the command line. It's possible to either use a
``--field`` option per field in the source file, or to separate field
definitions by a comma, as you would do in the *HAVING FIELDS* clause.
--cast <rule>
Allows setting a specific casting rule for loading the data.
--type <csv|fixed|db3|ixf|sqlite|mysql|mssql>
Allows forcing the source type, in case when the *SOURCE* parsing isn't
satisfying.
--encoding <encoding>
Set the encoding of the source file to load data from.
--before <filename>
Parse given filename for SQL queries and run them against the target
database before loading the data from the source. The queries are parsed
by pgloader itself: they need to be terminated by a semi-colon (;) and
the file may include `\i` or `\ir` commands to *include* another file.
--after <filename>
Parse given filename for SQL queries and run them against the target
database after having loaded the data from the source. The queries are
parsed in the same way as with the `--before` option, see above.
More Debug Information
^^^^^^^^^^^^^^^^^^^^^^
To get the maximum amount of debug information, you can use both the
`--verbose` and the `--debug` switches at the same time, which is equivalent
to saying `--client-min-messages data`. Then the log messages will show the
data being processed, in the cases where the code has explicit support for
it.

View File

@ -1,10 +1,12 @@
# pgloader: a quickstart
Pgloader Quick Start
====================
In simple cases, pgloader is very easy to use.
## CSV
CSV
---
Load data from a CSV file into a pre-existing table in your database:
Load data from a CSV file into a pre-existing table in your database::
pgloader --type csv \
--field id --field field \
@ -23,10 +25,11 @@ For documentation about the available syntaxes for the `--field` and
Note also that the PostgreSQL URI includes the target *tablename*.
## Reading from STDIN
Reading from STDIN
------------------
File based pgloader sources can be loaded from the standard input, as in the
following example:
following example::
pgloader --type csv \
--field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \
@ -38,14 +41,15 @@ following example:
The dash (`-`) character as a source is used to mean *standard input*, as
usual in Unix command lines. It's possible to stream compressed content to
pgloader with this technique, using the Unix pipe:
pgloader with this technique, using the Unix pipe::
gunzip -c source.gz | pgloader --type csv ... - pgsql:///target?foo
## Loading from CSV available through HTTP
Loading from CSV available through HTTP
---------------------------------------
The same command as just above can also be run if the CSV file happens to be
found on a remote HTTP location:
found on a remote HTTP location::
pgloader --type csv \
--field "usps,geoid,aland,awater,aland_sqmi,awater_sqmi,intptlat,intptlong" \
@ -62,7 +66,7 @@ notice). Also, in that case, we specify all the fields right into a single
Again, the PostgreSQL target connection string must contain the *tablename*
option and you have to ensure that the target table exists and may fit the
data. Here's the SQL command used in that example in case you want to try it
yourself:
yourself::
create table districts_longlat
(
@ -79,7 +83,8 @@ yourself:
Also notice that the same command will work against an archived version of
the same data.
## Streaming CSV data from an HTTP compressed file
Streaming CSV data from an HTTP compressed file
-----------------------------------------------
Finally, it's important to note that pgloader first fetches the content from
the HTTP URL it to a local file, then expand the archive when it's
@ -89,7 +94,7 @@ In some cases, either because pgloader has no direct support for your
archive format or maybe because expanding the archive is not feasible in
your environment, you might want to *stream* the content straight from its
remote location into PostgreSQL. Here's how to do that, using the old battle
tested Unix Pipes trick:
tested Unix Pipes trick::
curl http://pgsql.tapoueh.org/temp/2013_Gaz_113CDs_national.txt.gz \
| gunzip -c \
@ -104,28 +109,31 @@ Now the OS will take care of the streaming and buffering between the network
and the commands and pgloader will take care of streaming the data down to
PostgreSQL.
## Migrating from SQLite
Migrating from SQLite
---------------------
The following command will open the SQLite database, discover its tables
definitions including indexes and foreign keys, migrate those definitions
while *casting* the data type specifications to their PostgreSQL equivalent
and then migrate the data over:
and then migrate the data over::
createdb newdb
pgloader ./test/sqlite/sqlite.db postgresql:///newdb
## Migrating from MySQL
Migrating from MySQL
--------------------
Just create a database where to host the MySQL data and definitions and have
pgloader do the migration for you in a single command line:
pgloader do the migration for you in a single command line::
createdb pagila
pgloader mysql://user@localhost/sakila postgresql:///pagila
## Fetching an archived DBF file from a HTTP remote location
Fetching an archived DBF file from a HTTP remote location
---------------------------------------------------------
It's possible for pgloader to download a file from HTTP, unarchive it, and
only then open it to discover the schema then load the data:
only then open it to discover the schema then load the data::
createdb foo
pgloader --type dbf http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip postgresql:///foo

120
docs/ref/archive.rst Normal file
View File

@ -0,0 +1,120 @@
Archive (http, zip)
===================
This command instructs pgloader to load data from one or more files contained
in an archive. Currently the only supported archive format is *ZIP*, and the
archive might be downloaded from an *HTTP* URL.
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader archive.load
And the contents of the ``archive.load`` file could be inspired from the
following:
::
LOAD ARCHIVE
FROM /Users/dim/Downloads/GeoLiteCity-latest.zip
INTO postgresql:///ip4r
BEFORE LOAD
DO $$ create extension if not exists ip4r; $$,
$$ create schema if not exists geolite; $$,
EXECUTE 'geolite.sql'
LOAD CSV
FROM FILENAME MATCHING ~/GeoLiteCity-Location.csv/
WITH ENCODING iso-8859-1
(
locId,
country,
region null if blanks,
city null if blanks,
postalCode null if blanks,
latitude,
longitude,
metroCode null if blanks,
areaCode null if blanks
)
INTO postgresql:///ip4r?geolite.location
(
locid,country,region,city,postalCode,
location point using (format nil "(~a,~a)" longitude latitude),
metroCode,areaCode
)
WITH skip header = 2,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
AND LOAD CSV
FROM FILENAME MATCHING ~/GeoLiteCity-Blocks.csv/
WITH ENCODING iso-8859-1
(
startIpNum, endIpNum, locId
)
INTO postgresql:///ip4r?geolite.blocks
(
iprange ip4r using (ip-range startIpNum endIpNum),
locId
)
WITH skip header = 2,
fields optionally enclosed by '"',
fields escaped by double-quote,
fields terminated by ','
FINALLY DO
$$ create index blocks_ip4r_idx on geolite.blocks using gist(iprange); $$;
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
Archive Source Specification: FROM
----------------------------------
Filename or HTTP URI where to load the data from. When given an HTTP URL the
linked file will get downloaded locally before processing.
If the file is a `zip` file, the command line utility `unzip` is used to
expand the archive into files in `$TMPDIR`, or `/tmp` if `$TMPDIR` is unset
or set to a non-existing directory.
Then the following commands are used from the top level directory where the
archive has been expanded.
Archive Sub Commands
--------------------
- command [ *AND* command ... ]
A series of commands against the contents of the archive, at the moment
only `CSV`,`'FIXED` and `DBF` commands are supported.
Note that commands are supporting the clause *FROM FILENAME MATCHING*
which allows the pgloader command not to depend on the exact names of
the archive directories.
The same clause can also be applied to several files with using the
spelling *FROM ALL FILENAMES MATCHING* and a regular expression.
The whole *matching* clause must follow the following rule::
FROM [ ALL FILENAMES | [ FIRST ] FILENAME ] MATCHING
Archive Final SQL Commands
--------------------------
- *FINALLY DO*
SQL Queries to run once the data is loaded, such as `CREATE INDEX`.

133
docs/ref/copy.rst Normal file
View File

@ -0,0 +1,133 @@
COPY
====
This commands instructs pgloader to load from a file containing COPY TEXT
data as described in the PostgreSQL documentation.
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader copy.load
And the contents of the ``copy.load`` file could be inspired from the following:
::
LOAD COPY
FROM copy://./data/track.copy
(
trackid, track, album, media, genre, composer,
milliseconds, bytes, unitprice
)
INTO postgresql:///pgloader
TARGET TABLE track_full
WITH truncate
SET work_mem to '14MB',
standard_conforming_strings to 'on'
BEFORE LOAD DO
$$ drop table if exists track_full; $$,
$$ create table track_full (
trackid bigserial,
track text,
album text,
media text,
genre text,
composer text,
milliseconds bigint,
bytes bigint,
unitprice numeric
);
$$;
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
COPY Formatted Files Source Specification: FROM
-----------------------------------------------
Filename where to load the data from. This support local files, HTTP URLs
and zip files containing a single dbf file of the same name. Fetch such a
zip file from an HTTP address is of course supported.
- *inline*
The data is found after the end of the parsed commands. Any number of
empty lines between the end of the commands and the beginning of the
data is accepted.
- *stdin*
Reads the data from the standard input stream.
- *FILENAMES MATCHING*
The whole *matching* clause must follow the following rule::
[ ALL FILENAMES | [ FIRST ] FILENAME ]
MATCHING regexp
[ IN DIRECTORY '...' ]
The *matching* clause applies given *regular expression* (see above for
exact syntax, several options can be used here) to filenames. It's then
possible to load data from only the first match of all of them.
The optional *IN DIRECTORY* clause allows specifying which directory to
walk for finding the data files, and can be either relative to where the
command file is read from, or absolute. The given directory must exists.
COPY Formatted File Options: WITH
---------------------------------
When loading from a `COPY` file, the following options are supported:
- *delimiter*
Takes a single character as argument, which must be found inside single
quotes, and might be given as the printable character itself, the
special value \t to denote a tabulation character, or `0x` then an
hexadecimal value read as the ASCII code for the character.
This character is used as the *delimiter* when reading the data, in a
similar way to the PostgreSQL `COPY` option.
- *null*
Takes a quoted string as an argument (quotes can be either double quotes
or single quotes) and uses that string as the `NULL` representation in
the data.
This is similar to the *null* `COPY` option in PostgreSQL.
- *truncate*
When this option is listed, pgloader issues a `TRUNCATE` command against
the PostgreSQL target table before reading the data file.
- *disable triggers*
When this option is listed, pgloader issues an `ALTER TABLE ... DISABLE
TRIGGER ALL` command against the PostgreSQL target table before copying
the data, then the command `ALTER TABLE ... ENABLE TRIGGER ALL` once the
`COPY` is done.
This option allows loading data into a pre-existing table ignoring the
*foreign key constraints* and user defined triggers and may result in
invalid *foreign key constraints* once the data is loaded. Use with
care.
- *skip header*
Takes a numeric value as argument. Instruct pgloader to skip that many
lines at the beginning of the input file.

262
docs/ref/csv.rst Normal file
View File

@ -0,0 +1,262 @@
CSV
===
This command instructs pgloader to load data from a `CSV` file. Because of
the complexity of guessing the parameters of a CSV file, it's simpler to
instruct pgloader with how to parse the data in there, using the full
pgloader command syntax and CSV specifications as in the following example.
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader csv.load
And the contents of the ``csv.load`` file could be inspired from the following:
::
LOAD CSV
FROM 'GeoLiteCity-Blocks.csv' WITH ENCODING iso-646-us
HAVING FIELDS
(
startIpNum, endIpNum, locId
)
INTO postgresql://user@localhost:54393/dbname
TARGET TABLE geolite.blocks
TARGET COLUMNS
(
iprange ip4r using (ip-range startIpNum endIpNum),
locId
)
WITH truncate,
skip header = 2,
fields optionally enclosed by '"',
fields escaped by backslash-quote,
fields terminated by '\t'
SET work_mem to '32 MB', maintenance_work_mem to '64 MB';
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
CSV Source Specification: FROM
------------------------------
Filename where to load the data from. Accepts an *ENCODING* option. Use the
`--list-encodings` option to know which encoding names are supported.
The filename may be enclosed by single quotes, and could be one of the
following special values:
- *inline*
The data is found after the end of the parsed commands. Any number
of empty lines between the end of the commands and the beginning of
the data is accepted.
- *stdin*
Reads the data from the standard input stream.
- *FILENAME MATCHING*
The whole *matching* clause must follow the following rule::
[ ALL FILENAMES | [ FIRST ] FILENAME ]
MATCHING regexp
[ IN DIRECTORY '...' ]
The *matching* clause applies given *regular expression* (see above
for exact syntax, several options can be used here) to filenames.
It's then possible to load data from only the first match of all of
them.
The optional *IN DIRECTORY* clause allows specifying which directory
to walk for finding the data files, and can be either relative to
where the command file is read from, or absolute. The given
directory must exists.
Fields Specifications
---------------------
The *FROM* option also supports an optional comma separated list of *field*
names describing what is expected in the `CSV` data file, optionally
introduced by the clause `HAVING FIELDS`.
Each field name can be either only one name or a name following with
specific reader options for that field, enclosed in square brackets and
comma-separated. Supported per-field reader options are:
- *terminated by*
See the description of *field terminated by* below.
The processing of this option is not currently implemented.
- *date format*
When the field is expected of the date type, then this option allows
to specify the date format used in the file.
Date format string are template strings modeled against the
PostgreSQL `to_char` template strings support, limited to the
following patterns:
- YYYY, YYY, YY for the year part
- MM for the numeric month part
- DD for the numeric day part
- HH, HH12, HH24 for the hour part
- am, AM, a.m., A.M.
- pm, PM, p.m., P.M.
- MI for the minutes part
- SS for the seconds part
- MS for the milliseconds part (4 digits)
- US for the microseconds part (6 digits)
- unparsed punctuation signs: - . * # @ T / \ and space
Here's an example of a *date format* specification::
column-name [date format 'YYYY-MM-DD HH24-MI-SS.US']
- *null if*
This option takes an argument which is either the keyword *blanks*
or a double-quoted string.
When *blanks* is used and the field value that is read contains
only space characters, then it's automatically converted to an SQL
`NULL` value.
When a double-quoted string is used and that string is read as the
field value, then the field value is automatically converted to an
SQL `NULL` value.
- *trim both whitespace*, *trim left whitespace*, *trim right whitespace*
This option allows to trim whitespaces in the read data, either from
both sides of the data, or only the whitespace characters found on
the left of the streaing, or only those on the right of the string.
CSV Loading Options: WITH
-------------------------
When loading from a `CSV` file, the following options are supported:
- *truncate*
When this option is listed, pgloader issues a `TRUNCATE` command
against the PostgreSQL target table before reading the data file.
- *drop indexes*
When this option is listed, pgloader issues `DROP INDEX` commands
against all the indexes defined on the target table before copying
the data, then `CREATE INDEX` commands once the `COPY` is done.
In order to get the best performance possible, all the indexes are
created in parallel and when done the primary keys are built again
from the unique indexes just created. This two step process allows
creating the primary key index in parallel with the other indexes,
as only the `ALTER TABLE` command needs an *access exclusive lock*
on the target table.
- *disable triggers*
When this option is listed, pgloader issues an `ALTER TABLE ...
DISABLE TRIGGER ALL` command against the PostgreSQL target table
before copying the data, then the command `ALTER TABLE ... ENABLE
TRIGGER ALL` once the `COPY` is done.
This option allows loading data into a pre-existing table ignoring
the *foreign key constraints* and user defined triggers and may
result in invalid *foreign key constraints* once the data is loaded.
Use with care.
- *skip header*
Takes a numeric value as argument. Instruct pgloader to skip that
many lines at the beginning of the input file.
- *csv header*
Use the first line read after *skip header* as the list of csv field
names to be found in the CSV file, using the same CSV parameters as
for the CSV data.
- *trim unquoted blanks*
When reading unquoted values in the `CSV` file, remove the blanks
found in between the separator and the value. That behaviour is the
default.
- *keep unquoted blanks*
When reading unquoted values in the `CSV` file, keep blanks found in
between the separator and the value.
- *fields optionally enclosed by*
Takes a single character as argument, which must be found inside single
quotes, and might be given as the printable character itself, the
special value \t to denote a tabulation character, the special value \'
to denote a single-quote, or `0x` then an hexadecimal value read as the
ASCII code for the character.
The following options specify the same enclosing character, a single quote::
fields optionally enclosed by '\''
fields optionally enclosed by '0x27'
This character is used as the quoting character in the `CSV` file,
and defaults to double-quote.
- *fields not enclosed*
By default, pgloader will use the double-quote character as the
enclosing character. If you have a CSV file where fields are not
enclosed and are using double-quote as an expected ordinary
character, then use the option *fields not enclosed* for the CSV
parser to accept those values.
- *fields escaped by*
Takes either the special value *backslash-quote* or *double-quote*,
or any value supported by the *fields terminated by* option (see
below). This value is used to recognize escaped field separators
when they are to be found within the data fields themselves.
Defaults to *double-quote*.
- *csv escape mode*
Takes either the special value *quote* (the default) or *following*
and allows the CSV parser to parse either only escaped field
separator or any character (including CSV data) when using the
*following* value.
- *fields terminated by*
Takes a single character as argument, which must be found inside
single quotes, and might be given as the printable character itself,
the special value \t to denote a tabulation character, or `0x` then
an hexadecimal value read as the ASCII code for the character.
This character is used as the *field separator* when reading the
`CSV` data.
- *lines terminated by*
Takes a single character as argument, which must be found inside
single quotes, and might be given as the printable character itself,
the special value \t to denote a tabulation character, or `0x` then
an hexadecimal value read as the ASCII code for the character.
This character is used to recognize *end-of-line* condition when
reading the `CSV` data.

88
docs/ref/dbf.rst Normal file
View File

@ -0,0 +1,88 @@
DBF
===
This command instructs pgloader to load data from a `DBF` file. A default
set of casting rules are provided and might be overloaded and appended to by
the command.
Using advanced options and a load command file
----------------------------------------------
Here's an example with a remote HTTP source and some user defined casting
rules. The command then would be:
::
$ pgloader dbf.load
And the contents of the ``dbf.load`` file could be inspired from the following:
::
LOAD DBF
FROM http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/reg2013.dbf
INTO postgresql://user@localhost/dbname
WITH truncate, create table
CAST column reg2013.region to integer,
column reg2013.tncc to smallint;
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
DBF Source Specification: FROM
------------------------------
Filename where to load the data from. This support local files, HTTP URLs
and zip files containing a single dbf file of the same name. Fetch such a
zip file from an HTTP address is of course supported.
DBF Loading Options: WITH
-------------------------
When loading from a `DBF` file, the following options are supported:
- *truncate*
When this option is listed, pgloader issues a `TRUNCATE` command against
the PostgreSQL target table before reading the data file.
- *disable triggers*
When this option is listed, pgloader issues an `ALTER TABLE ... DISABLE
TRIGGER ALL` command against the PostgreSQL target table before copying
the data, then the command `ALTER TABLE ... ENABLE TRIGGER ALL` once the
`COPY` is done.
This option allows loading data into a pre-existing table ignoring the
*foreign key constraints* and user defined triggers and may result in
invalid *foreign key constraints* once the data is loaded. Use with
care.
- *create table*
When this option is listed, pgloader creates the table using the meta
data found in the `DBF` file, which must contain a list of fields with
their data type. A standard data type conversion from DBF to PostgreSQL
is done.
- *table name*
This options expects as its value the possibly qualified name of the
table to create.
Default DB3 Casting Rules
-------------------------
When migrating from DB3 the following Casting Rules are provided::
type C to text using db3-trim-string
type M to text using db3-trim-string
type N to numeric using db3-numeric-to-pgsql-integer
type I to numeric using db3-numeric-to-pgsql-numeric
type L to boolean using logical-to-boolean
type D to date using db3-date-to-pgsql-date

204
docs/ref/fixed.rst Normal file
View File

@ -0,0 +1,204 @@
Fixed Columns
=============
This command instructs pgloader to load data from a text file containing
columns arranged in a *fixed size* manner.
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader fixed.load
And the contents of the ``fixed.load`` file could be inspired from the following:
::
LOAD FIXED
FROM inline
(
a from 0 for 10,
b from 10 for 8,
c from 18 for 8,
d from 26 for 17 [null if blanks, trim right whitespace]
)
INTO postgresql:///pgloader
TARGET TABLE fixed
(
a, b,
c time using (time-with-no-separator c),
d
)
WITH truncate
SET work_mem to '14MB',
standard_conforming_strings to 'on'
BEFORE LOAD DO
$$ drop table if exists fixed; $$,
$$ create table fixed (
a integer,
b date,
c time,
d text
);
$$;
01234567892008052011431250firstline
01234562008052115182300left blank-padded
12345678902008052208231560another line
2345609872014092914371500
2345678902014092914371520
Note that the example comes from the test suite of pgloader, where we use
the advanced feature ``FROM inline`` that allows embedding the source data
within the command file. In most cases a more classic FROM clause loading
the data from a separate file would be used.
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
Fixed File Format Source Specification: FROM
--------------------------------------------
Filename where to load the data from. Accepts an *ENCODING* option. Use the
`--list-encodings` option to know which encoding names are supported.
The filename may be enclosed by single quotes, and could be one of the
following special values:
- *inline*
The data is found after the end of the parsed commands. Any number
of empty lines between the end of the commands and the beginning of
the data is accepted.
- *stdin*
Reads the data from the standard input stream.
- *FILENAMES MATCHING*
The whole *matching* clause must follow the following rule::
[ ALL FILENAMES | [ FIRST ] FILENAME ]
MATCHING regexp
[ IN DIRECTORY '...' ]
The *matching* clause applies given *regular expression* (see above
for exact syntax, several options can be used here) to filenames.
It's then possible to load data from only the first match of all of
them.
The optional *IN DIRECTORY* clause allows specifying which directory
to walk for finding the data files, and can be either relative to
where the command file is read from, or absolute. The given
directory must exists.
Fields Specifications
---------------------
The *FROM* option also supports an optional comma separated list of *field*
names describing what is expected in the `FIXED` data file.
Each field name is composed of the field name followed with specific reader
options for that field. Supported per-field reader options are the
following, where only *start* and *length* are required.
- *start*
Position in the line where to start reading that field's value. Can
be entered with decimal digits or `0x` then hexadecimal digits.
- *length*
How many bytes to read from the *start* position to read that
field's value. Same format as *start*.
Those optional parameters must be enclosed in square brackets and
comma-separated:
- *terminated by*
See the description of *field terminated by* below.
The processing of this option is not currently implemented.
- *date format*
When the field is expected of the date type, then this option allows
to specify the date format used in the file.
Date format string are template strings modeled against the
PostgreSQL `to_char` template strings support, limited to the
following patterns:
- YYYY, YYY, YY for the year part
- MM for the numeric month part
- DD for the numeric day part
- HH, HH12, HH24 for the hour part
- am, AM, a.m., A.M.
- pm, PM, p.m., P.M.
- MI for the minutes part
- SS for the seconds part
- MS for the milliseconds part (4 digits)
- US for the microseconds part (6 digits)
- unparsed punctuation signs: - . * # @ T / \ and space
Here's an example of a *date format* specification::
column-name [date format 'YYYY-MM-DD HH24-MI-SS.US']
- *null if*
This option takes an argument which is either the keyword *blanks*
or a double-quoted string.
When *blanks* is used and the field value that is read contains only
space characters, then it's automatically converted to an SQL `NULL`
value.
When a double-quoted string is used and that string is read as the
field value, then the field value is automatically converted to an
SQL `NULL` value.
- *trim both whitespace*, *trim left whitespace*, *trim right whitespace*
This option allows to trim whitespaces in the read data, either from
both sides of the data, or only the whitespace characters found on
the left of the streaing, or only those on the right of the string.
Fixed File Format Loading Options: WITH
---------------------------------------
When loading from a `FIXED` file, the following options are supported:
- *truncate*
When this option is listed, pgloader issues a `TRUNCATE` command
against the PostgreSQL target table before reading the data file.
- *disable triggers*
When this option is listed, pgloader issues an `ALTER TABLE ...
DISABLE TRIGGER ALL` command against the PostgreSQL target table
before copying the data, then the command `ALTER TABLE ... ENABLE
TRIGGER ALL` once the `COPY` is done.
This option allows loading data into a pre-existing table ignoring
the *foreign key constraints* and user defined triggers and may
result in invalid *foreign key constraints* once the data is loaded.
Use with care.
- *skip header*
Takes a numeric value as argument. Instruct pgloader to skip that
many lines at the beginning of the input file.

83
docs/ref/ixf.rst Normal file
View File

@ -0,0 +1,83 @@
IXF
===
This command instructs pgloader to load data from an IBM `IXF` file.
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader ixf.load
And the contents of the ``ixf.load`` file could be inspired from the following:
::
LOAD IXF
FROM data/nsitra.test1.ixf
INTO postgresql:///pgloader
TARGET TABLE nsitra.test1
WITH truncate, create table, timezone UTC
BEFORE LOAD DO
$$ create schema if not exists nsitra; $$,
$$ drop table if exists nsitra.test1; $$;
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
IXF Source Specification: FROM
------------------------------
Filename where to load the data from. This support local files, HTTP URLs
and zip files containing a single ixf file of the same name. Fetch such a
zip file from an HTTP address is of course supported.
IXF Loading Options: WITH
-------------------------
When loading from a `IXF` file, the following options are supported:
- *truncate*
When this option is listed, pgloader issues a `TRUNCATE` command against
the PostgreSQL target table before reading the data file.
- *disable triggers*
When this option is listed, pgloader issues an `ALTER TABLE ... DISABLE
TRIGGER ALL` command against the PostgreSQL target table before copying
the data, then the command `ALTER TABLE ... ENABLE TRIGGER ALL` once the
`COPY` is done.
This option allows loading data into a pre-existing table ignoring the
*foreign key constraints* and user defined triggers and may result in
invalid *foreign key constraints* once the data is loaded. Use with
care.
- *create table*
When this option is listed, pgloader creates the table using the meta
data found in the `DBF` file, which must contain a list of fields with
their data type. A standard data type conversion from DBF to PostgreSQL
is done.
- *table name*
This options expects as its value the possibly qualified name of the
table to create.
- *timezone*
This options allows to specify which timezone is used when parsing
timestamps from an IXF file, and defaults to *UTC*. Expected values are
either `UTC`, `GMT` or a single quoted location name such as
`'Universal'` or `'Europe/Paris'`.

242
docs/ref/mssql.rst Normal file
View File

@ -0,0 +1,242 @@
MS SQL to Postgres
==================
This command instructs pgloader to load data from a MS SQL database.
Automatic discovery of the schema is supported, including build of the
indexes, primary and foreign keys constraints.
Using default settings
----------------------
Here is the simplest command line example, which might be all you need:
::
$ pgloader mssql://user@mshost/dbname pgsql://pguser@pghost/dbname
Using advanced options and a load command file
----------------------------------------------
The command then would be:
::
$ pgloader ms.load
And the contents of the command file ``ms.load`` could be inspired from the
following:
::
load database
from mssql://user@host/dbname
into postgresql:///dbname
including only table names like 'GlobalAccount' in schema 'dbo'
set work_mem to '16MB', maintenance_work_mem to '512 MB'
before load do $$ drop schema if exists dbo cascade; $$;
Common Clauses
--------------
Please refer to :ref:`common_clauses` for documentation about common
clauses.
MS SQL Database Source Specification: FROM
------------------------------------------
Connection string to an existing MS SQL database server that listens and
welcome external TCP/IP connection. As pgloader currently piggybacks on the
FreeTDS driver, to change the port of the server please export the `TDSPORT`
environment variable.
MS SQL Database Migration Options: WITH
---------------------------------------
When loading from a `MS SQL` database, the same options as when loading a
`MYSQL` database are supported. Please refer to the MYSQL section. The
following options are added:
- *create schemas*
When this option is listed, pgloader creates the same schemas as found
on the MS SQL instance. This is the default.
- *create no schemas*
When this option is listed, pgloader refrains from creating any schemas
at all, you must then ensure that the target schema do exist.
MS SQL Database Casting Rules
-----------------------------
CAST
^^^^
The cast clause allows to specify custom casting rules, either to overload
the default casting rules or to amend them with special cases.
Please refer to the MS SQL CAST clause for details.
MS SQL Views Support
--------------------
MS SQL views support allows pgloader to migrate view as if they were base
tables. This feature then allows for on-the-fly transformation from MS SQL
to PostgreSQL, as the view definition is used rather than the base data.
MATERIALIZE VIEWS
^^^^^^^^^^^^^^^^^
This clause allows you to implement custom data processing at the data
source by providing a *view definition* against which pgloader will query
the data. It's not possible to just allow for plain `SQL` because we want to
know a lot about the exact data types of each column involved in the query
output.
This clause expect a comma separated list of view definitions, each one
being either the name of an existing view in your database or the following
expression::
*name* `AS` `$$` *sql query* `$$`
The *name* and the *sql query* will be used in a `CREATE VIEW` statement at
the beginning of the data loading, and the resulting view will then be
dropped at the end of the data loading.
MATERIALIZE ALL VIEWS
^^^^^^^^^^^^^^^^^^^^^
Same behaviour as *MATERIALIZE VIEWS* using the dynamic list of views as
returned by MS SQL rather than asking the user to specify the list.
MS SQL Partial Migration
------------------------
INCLUDING ONLY TABLE NAMES LIKE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Introduce a comma separated list of table name patterns used to limit the
tables to migrate to a sublist. More than one such clause may be used, they
will be accumulated together.
Example::
including only table names like 'GlobalAccount' in schema 'dbo'
EXCLUDING TABLE NAMES LIKE
^^^^^^^^^^^^^^^^^^^^^^^^^^
Introduce a comma separated list of table name patterns used to exclude
table names from the migration. This filter only applies to the result of
the *INCLUDING* filter.
::
excluding table names matching 'LocalAccount' in schema 'dbo'
MS SQL Schema Transformations
-----------------------------
ALTER SCHEMA '...' RENAME TO '...'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Allows to rename a schema on the flight, so that for instance the tables
found in the schema 'dbo' in your source database will get migrated into the
schema 'public' in the target database with this command::
alter schema 'dbo' rename to 'public'
ALTER TABLE NAMES MATCHING ... IN SCHEMA '...'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Introduce a comma separated list of table names or *regular expressions*
that you want to target in the pgloader *ALTER TABLE* command. Available
actions are *SET SCHEMA*, *RENAME TO*, and *SET*::
ALTER TABLE NAMES MATCHING ~/_list$/, 'sales_by_store', ~/sales_by/
IN SCHEMA 'dbo'
SET SCHEMA 'mv'
ALTER TABLE NAMES MATCHING 'film' IN SCHEMA 'dbo' RENAME TO 'films'
ALTER TABLE NAMES MATCHING ~/./ IN SCHEMA 'dbo' SET (fillfactor='40')
ALTER TABLE NAMES MATCHING ~/./ IN SCHEMA 'dbo' SET TABLESPACE 'tlbspc'
You can use as many such rules as you need. The list of tables to be
migrated is searched in pgloader memory against the *ALTER TABLE* matching
rules, and for each command pgloader stops at the first matching criteria
(regexp or string).
No *ALTER TABLE* command is sent to PostgreSQL, the modification happens at
the level of the pgloader in-memory representation of your source database
schema. In case of a name change, the mapping is kept and reused in the
*foreign key* and *index* support.
The *SET ()* action takes effect as a *WITH* clause for the `CREATE TABLE`
command that pgloader will run when it has to create a table.
The *SET TABLESPACE* action takes effect as a *TABLESPACE* clause for the
`CREATE TABLE` command that pgloader will run when it has to create a table.
The matching is done in pgloader itself, with a Common Lisp regular
expression lib, so doesn't depend on the *LIKE* implementation of MS SQL,
nor on the lack of support for regular expressions in the engine.
MS SQL Driver setup and encoding
--------------------------------
pgloader is using the `FreeTDS` driver, and internally expects the data to
be sent in utf-8. To achieve that, you can configure the FreeTDS driver with
those defaults, in the file `~/.freetds.conf`::
[global]
tds version = 7.4
client charset = UTF-8
Default MS SQL Casting Rules
----------------------------
When migrating from MS SQL the following Casting Rules are provided:
Numbers::
type tinyint to smallint
type float to float using float-to-string
type real to real using float-to-string
type double to double precision using float-to-string
type numeric to numeric using float-to-string
type decimal to numeric using float-to-string
type money to numeric using float-to-string
type smallmoney to numeric using float-to-string
Texts::
type char to text drop typemod
type nchar to text drop typemod
type varchar to text drop typemod
type nvarchar to text drop typemod
type xml to text drop typemod
Binary::
type binary to bytea using byte-vector-to-bytea
type varbinary to bytea using byte-vector-to-bytea
Date::
type datetime to timestamptz
type datetime2 to timestamptz
Others::
type bit to boolean
type hierarchyid to bytea
type geography to bytea
type uniqueidentifier to uuid using sql-server-uniqueidentifier-to-uuid

Some files were not shown because too many files have changed in this diff Show More