Commit Graph

790 Commits

Author SHA1 Message Date
Seamus Abshere
e667aceba7 it's CL=ccl not CC=ccl 2014-06-02 17:19:58 -03:00
Dimitri Fontaine
9fc7589a9c Output all reporting to *terminal-io*, fix #68. 2014-06-02 12:08:27 +02:00
Dimitri Fontaine
df6e6c4673 TODO: add support for other archive formats. 2014-05-29 00:12:03 +02:00
Dimitri Fontaine
ae63c9b85c Improve COPY CONTEXT message parsing, fix #67.
When adding the CONTEXT message parsing I totally forgot that PostgreSQL
provides a nice error message translation capability. The code now copes
better with the situation, using a more advanced regular expression.

We could inline the known translations in the matching, but that would
be tedious to maintain, so we just use loose matching rules here.
2014-05-28 17:23:08 +02:00
Dimitri Fontaine
e93ba8b887 Fix handling --client-min-messages and --log-min-messages.
Should help with issue #67 by allowing --client-min-messages to
effectively control entering the debugger in case of unhandled
conditions, etc.

Contrary to the discussion, in this patch --log-min-messages has no
impact on the behavior of the console and interactive behaviors.
2014-05-28 16:37:38 +02:00
Dimitri Fontaine
89d1ab460d Handle both PostgreSQL reserved keywords catcode, fix #63. 2014-05-27 17:36:00 +02:00
Dimitri Fontaine
3454247cc7 Fix MySQL view cleanup.
In case of PostgreSQL schema preparation error, and when some
materialized views where given with their SQL command, they were left
over by pgloader. The next run would then fail because the view already
exists at CREATE VIEW time.

Fix that by cleaning up materialized views we just created in handling
any condition signaled when preparing the PostgreSQL schema.
2014-05-27 17:34:59 +02:00
Dimitri Fontaine
a2370938b6 MATERIALIZE ALL VIEWS.
Complete the MySQL migration feature.
2014-05-26 18:03:50 +02:00
Dimitri Fontaine
e1bf53906d Don't send over useless verbose log messages.
When in :data logging mode we log the whole data set as we read then
write it, which is quite a lot of data. Our current logging system works
by filling up a queue that the cl-log lib is then fed from, and sending
lots of data in that queue is way expensive, stop doing that.

Hopefully we don't need to revisit the logs more than that, the other
messages should be few enough not to count much when doing a full load.
2014-05-26 16:59:12 +02:00
Dimitri Fontaine
2637bb7e81 Avoid double logging the TRUNCATE call, that's scary. 2014-05-26 15:47:20 +02:00
Dimitri Fontaine
e9e9e364b0 Add optional clauses USING FIELDS and TARGET COLUMNS. 2014-05-26 15:04:06 +02:00
Dimitri Fontaine
b17383fa90 Allow IN DIRECTORY sub-clause for the FILENAME MATCHING clause.
With this the user is now able to have a way about where the files are
going to be read and matched against the regular expression. It used not
to be necessary in the archive expansion mode, but is required now that
the feature is exposed in more cases.
2014-05-26 14:45:12 +02:00
Dimitri Fontaine
a0518f2e98 Document FILENAMES MATCHING option. 2014-05-26 11:08:10 +02:00
Dimitri Fontaine
36805afc64 Fix *csv-path-root* at run-time.
When using LOAD CSV it's possible to load from filename matching a
regular expression, but for that to work the *csv-path-root* needs to be
properly setup at run-time.
2014-05-26 11:01:19 +02:00
Dimitri Fontaine
51b9618cf6 Fix a call to truncate-tables which didn't get the memo.
In passing, have a default identifier-case of :downcase.
2014-05-26 10:59:35 +02:00
Dimitri Fontaine
92ebb13042 Keep the order in which we saw files when matching filenames. 2014-05-26 10:58:30 +02:00
Dimitri Fontaine
dbc9699940 Review the TODO list. 2014-05-26 00:04:50 +02:00
Dimitri Fontaine
24c0580e11 Move the TODO into its own file. 2014-05-25 23:57:18 +02:00
Dimitri Fontaine
c21f3f06ff Retain NULL tinyints in tinyint-to-boolean, fix #65. 2014-05-24 00:03:41 +02:00
Dimitri Fontaine
8b2b2af076 Use quicklisp release of qmynd and improve source dependencies.
As seen in #64 it's no longer necessary anymore to use a local clone of
qmynd to be able to compile pgloader: simplify the Makefile accordingly.

In passing, add source level dependencies so that if you edit any source
lisp file the binary will get automatically rebuilt by `make`.
2014-05-23 16:00:51 +02:00
Dimitri Fontaine
b1ba09a21b Handle MySQL FK column names idenfier case, fix #62.
The code forgot completely that MySQL column name references in foreign
key definitions have to follow the identifier case rules, this patch fix
that.

To be able to do that, we need to parse the GROUP_CONCAT() result that
lists the FK columns, as there's apparently no arrays in MySQL. The
problem here is that about any character is allowed in column names when
`quoted`, so using a comma here might reveal to be fragile later.
2014-05-22 12:35:54 +02:00
Dimitri Fontaine
d14f9ce334 Add the ELS Lightning Talk video to pgloader.io. 2014-05-20 22:52:17 +02:00
Dimitri Fontaine
e710cacad1 Truncate all tables in a single command, fix #61.
The truncate command is only sent to PostgreSQL when we didn't just
CREATE TABLE before. Some refactoring would be necessary to fit the
TRUNCATE command within the same transaction as the CREATE TABLE
command, for PostgreSQL performances.

This patch has been testing with MySQL and SQLite sources, the trick is
that to be able to test it, it's needed to first make a full
import (creating the target tables), so the test are not modified yet.
2014-05-19 18:07:35 +02:00
Dimitri Fontaine
c3742a9410 Typo fix cl-base64 system's name, fix the fix for #60. 2014-05-16 23:36:45 +02:00
Dimitri Fontaine
9e12035ca1 Review SQLite blob types in light of "manifest typing", fix #60.
When using SQLite 3, a blob column might return either string of byte
vector values dynamically depending on the data itself, or maybe some
more complex parameters controlled at data insert time.

Hard-code the rule that a blob column returned as a string is in fact
base64 encoded (which looks like common practice) and decode it
automatically when needed, before sending to byte-vector-to-bytea. It
might be a tad slow but at least the data is properly converted.

In future, that decision might come and byte us in the back again, at
which point it'll be necessary to consider full casting options as in
the MySQL CAST rules. It seems like a big enough win for now if we can
avoid that.
2014-05-16 23:13:57 +02:00
Dimitri Fontaine
39af63b053 Implement support for SQLite blob to bytea, fixes #59.
This issue has been re-opened with blob instead of double. Semi-blindly
implement support for the blob type with an image data type.

Disturbingly enough when tested with non-binary data SQLite was
returning strings rather than byte vectors, tripping up the transform
function that sure expects byte vectors.
2014-05-16 00:28:02 +02:00
Dimitri Fontaine
d6c457d89a Add support for SQLite "double" data type, Fix #59.
This time with a test case rather than trying to blindly address the
problem in a very small amount of time.
2014-05-15 23:28:21 +02:00
Dimitri Fontaine
efda3eebfa Attempt at fixing #59 (sqlite double type casting).
Blindly add a new type conversion in the SQLite code base to handle the
source type DOUBLE and convert it to "double precision".
2014-05-13 11:57:03 +02:00
Dimitri Fontaine
d7b05ba411 Handle more conditions, fix #57.
Turns out that in cases it's not possible to call format-vector-row on
MySQL result sets, because it's been sending us vector of bytes (blob)
while the expected data (from the table definition) clearly is text.

Handle the error as an input reading error, skipping the line and being
verbose about it in the logs. This patch fails to update the stats about
what's happening because, so might need later changes.
2014-05-11 18:52:07 +02:00
Dimitri Fontaine
6d92dc251f Fix another useless use of loop. 2014-05-11 18:49:31 +02:00
Dimitri Fontaine
223199e866 Prepare and publish a MacOSX package file.
MacOSX users will be at home when using the usual packaging installer.
The binary file is installed into /usr/local/bin/pgloader and the man
page is installed too.
2014-05-11 18:37:38 +02:00
Dimitri Fontaine
c9f7e487e9 Add the source tarball to the download section. 2014-05-05 22:22:24 +02:00
Dimitri Fontaine
6c9fb28eb9 Fix Typo in the main web page. 2014-05-05 22:22:09 +02:00
Dimitri Fontaine
31947e6c20 make latest build the Quicklisp tarball release. 2014-05-05 17:24:41 +02:00
Dimitri Fontaine
c38798a4dd Implement BEFORE/AFTER LOAD EXECUTE 'filename'.
That allows using the same SQL files as usual when using pgloader, as it
even supports the \i and \ir psql features (and dollar quoting, etc).

In passing, refactor docs to avoid saying the same things all over the
place, which isn't a very good idea in a man page, at least as far
editing it is involved.
2014-05-04 23:04:45 +02:00
Dimitri Fontaine
9a90be1977 Fix the README example... 2014-05-03 16:10:55 +02:00
Dimitri Fontaine
267a1cc755 The Useless Use Of Loop did strike. 2014-05-03 15:55:02 +02:00
Dimitri Fontaine
ad18c5370d Fix buildapp dependency.
We need a different buildapp binary file for SBCL and for CCL, so make
it appear that way in the Makefile, and have both
./build/bin/buildapp.sbcl and ./build/bin/buildapp.ccl.

That avoid really confusing error messages when trying to build pgloader
with CCL and using the SBCL-compiled buildapp binary...
2014-05-03 15:45:42 +02:00
Dimitri Fontaine
e39788e5cd Fix some CCL warnings.
Those were preventing a buildapp based build.
2014-05-03 15:36:30 +02:00
Dimitri Fontaine
6e58db2994 Improve self-upgrading.
There's no reason not to parse again the command line with the newly
loaded code actually, so be sure to do the self-upgrade dance first
thing and recurse to the pgloader::main function (with a guard).
2014-05-03 15:22:34 +02:00
Dimitri Fontaine
f34017d023 Improve version strings.
Have the abbreviated git hash appear in the version string when not
using a released version of pgloader.
2014-05-03 15:21:32 +02:00
Dimitri Fontaine
fecae2c2d9 Implement --self-upgrade capacity.
As from now, to install a new version of pgloader when you have an older
one, say because there's that bug that got fixed meanwhile, all you need
to do is run

  $ git clone https://github.com/dimitri/pgloader.git /tmp/pgloader
  $ pgloader --self-upgrade /tmp/pgloader <options as usual>

Any Common Lisp developper using the product is already doing that many
times a day, it might prove useful for users to be able to hot-patch
themselves too, after all.
2014-05-03 00:25:44 +02:00
Dimitri Fontaine
1d480c2590 Refactor the parser connection bindings code production.
Every command was maintaining its own copy of what should have been the
same code from day one, centralize it.
2014-05-02 23:46:35 +02:00
Dimitri Fontaine
8d34d54772 Makefile rules optimisations. 2014-05-02 23:45:36 +02:00
Dimitri Fontaine
ee498111bc Implement MySQL local (socket) connection. Fix #39.
The parser was happily parsing such a connection string as the
following, but the rest of the code didn't really know what to do about
it:

  mysql://unix:/var/run/mysqld/mysqld.sock:/main

In passing, fix bugs where the PostgreSQL unix domain socket connection
was still shy of a brick load, omitting to consider the case where the
connection host is actually a list of '(:unix . "path/to/socket").
2014-05-02 22:48:17 +02:00
Dimitri Fontaine
bce75fc4e5 Proper debian packaging.
This packaging requires all pgloader dependencies to be available as a
debian package within the distribution, which is an work-in-progress
happening concurrently to this patch.

The current situation allows to actually build the pgloader package the
proper way already, some more needs to happen before anybody can do that
from a public debian repository.
2014-04-30 00:30:44 +02:00
Dimitri Fontaine
182128775b Another encoding and external formats fix for portability.
Some of our internal values now depend on the implementation, and could
either be a symbol on SBCL or an external-format structure on CCL. We
could typecase our way out I suppose, but it might be that SBCL has a
different version of the external-format type, so we'd rather use #+.
2014-04-29 15:25:56 +02:00
Dimitri Fontaine
9084a01086 Switch a test case to the "utf-8" spelling.
The spelling "utf8" is not recognized by CCL.
2014-04-29 15:24:12 +02:00
Dimitri Fontaine
1d5d0ae72f Update the bossa.load test case.
The archive contents seem to have changed, and the regular expression to
match files that we were using doesn't match any filename in the archive
any more.

Also, have the command load more data by parsing more files, using the
ALL FILENAME MATCHING clause.
2014-04-29 14:51:14 +02:00
Dimitri Fontaine
f0cc4ddef9 Fix filename matching when no match is found. 2014-04-29 14:49:55 +02:00