Commit Graph

1568 Commits

Author SHA1 Message Date
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