Commit Graph

1568 Commits

Author SHA1 Message Date
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
Dimitri Fontaine
f5f584fdf1 Fix parsing ccl:describe-character-encodings.
First, despite the documentation mentionning the function writes
to *terminal-io*, in fact it's doing (format t ...) and thus the result
is written to *standard-output*.

Second, CCL has encodings with no aliases.
2014-04-29 14:25:40 +02:00
Dimitri Fontaine
0c371797dc Publish version 3.0.99 on pgloader.io website. 2014-04-29 14:04:40 +02:00
Dimitri Fontaine
a5a29407f0 Release pgloader version 3.0.99. 2014-04-29 13:59:33 +02:00
Dimitri Fontaine
24281fb679 Include the new version of the manpage, pre-compiled. 2014-04-29 11:54:37 +02:00
Dimitri Fontaine
943373d8e3 No patches needed anymore to compile pgloader. 2014-04-29 11:48:09 +02:00
Dimitri Fontaine
c0d9bb4d8f Allows to build pgloader image using CCL.
Too many Makefile commands where hard-coded using SBCL, which prevented
from building successfully against CCL. That's now fixed.
2014-04-29 11:47:22 +02:00
Dimitri Fontaine
40128dbd75 Fix with-monitor support of :start-logger option.
It used to still launch an extra set of threads for monitoring where,
and that would confuse CCL where it's not possible to write into a
stream from more than one thread concurrently.
2014-04-29 11:43:03 +02:00
Dimitri Fontaine
0f62751a3f Improve summary output.
Try at having a deterministic ouput of it, which still apparently is not
always the case when using SBCL, now that it's been switched to using
the explicit *terminal-io* rather than t.

This change is needed for CCL support, though, where you don't get to
write to the same stream from different threads.
2014-04-29 11:42:02 +02:00
Dimitri Fontaine
3abcfeb569 Avoid empty index definitions in SQLite, fixes #52.
I could get down to the problem here, which is that a couple of indexes
where reported to pgloader but without any SQL definition for them, and
then pgloader would wait for non existing tasks.

It seems easier to just skip does indexes, that's what this patch does.
2014-04-28 16:00:34 +02:00
Dimitri Fontaine
9516a90d9d Fix SQLite support for filename parsing.
The code didn't get the memo about the way we now do support source
filenames and all.
2014-04-28 15:20:30 +02:00
Dimitri Fontaine
b758058208 Fix the fix for parsing quoted-filenames. 2014-04-28 15:18:18 +02:00
Dimitri Fontaine
b5c89e750c Quick review of the generic API documentation strings. 2014-04-28 14:36:15 +02:00
Dimitri Fontaine
429232c3de Fix loading data from stdin: fix #53.
The stdin support really was one brick shy of a load, and in particular
with-open-file was used against a stream when using that option.
2014-04-27 23:38:02 +02:00
Dimitri Fontaine
b5dec87915 Allow any non-quote characters in a quoted filename.
In particular, allow for a space to be used in the filename. The only
character that is not permitted anymore is the quote itself ('), it
should be easy enough to allow for escaping it as in the password field
if required.

Should probably fix #54, even though the lack of data currently reported
in that issue makes it a blind guess only.
2014-04-27 22:49:27 +02:00
Dimitri Fontaine
efd11ab759 Add user options to control pgloader batch behaviour.
The new WITH options allows the user to set values for the dynamic
variables *copy-batch-rows*, *copy-batch-size* and *concurrent-batches*.
That's needed in case like in issue #16 even with the batch size
defaulting to what looks like a proper setup.

In a longer term a review of the pgloader memory usage should be done
seriously, the numbers being way higher than the batch sizes we do setup
here.
2014-04-27 22:37:17 +02:00
Dimitri Fontaine
78a988eb47 Oops, forgot to add the new file charsets.lisp. 2014-04-26 18:55:43 +02:00
Dimitri Fontaine
35ca4927e9 Get rid of some lib dependencies.
The charset business isn't worth depending on an AGPL licenced lib which
is part of a huge Quicklisp system.
2014-04-25 17:21:11 +02:00
Dimitri Fontaine
cb20cb7145 The make clean target needs more work. 2014-04-25 17:17:19 +02:00
Dimitri Fontaine
789d854799 Fix issue #49 where data could be considered as a format string. 2014-04-23 17:03:35 +02:00
Dimitri Fontaine
a2109a0cd5 Add build/bin in the git repository, we need that dir now. 2014-04-23 16:13:24 +02:00
Dimitri Fontaine
77f87fb8b3 Copy/past'o fix. 2014-04-22 17:21:44 +02:00
Dimitri Fontaine
71fcd6b748 Add some INSTALL notes, with dependency instructions. 2014-04-22 17:16:51 +02:00