Commit Graph

67 Commits

Author SHA1 Message Date
Dimitri Fontaine
368dd88b48 Implement GETENV facility for reading FROM and INTO clauses.
It might be important to be able to use the exact same pgloader commands
file but adapt its source and target depending on the environment where
the command is to be run (production, development, staging, etc).

Introduce the new sub-clause GETENV 'variable-name' to that effect.

The regression test facility that we have now isn't nearly sophisticated
enough to support this, so the feature isn't yet covered.
2014-07-24 18:28:59 +02:00
Dimitri Fontaine
a090f2fe3d Fix CCL compat where nil can't be a plist key. 2014-07-18 12:49:14 +02:00
Dimitri Fontaine
07b5aa3ed6 Add BEFORE/AFTER LOAD clauses to IXF and DBF commands. 2014-07-17 16:56:13 +02:00
Dimitri Fontaine
e4948a3627 Move some logic up to the parser.
As per grammar review at  https://github.com/nikodemus/esrap/issues/26,
improve the situation.
2014-07-16 23:25:46 +02:00
Dimitri Fontaine
0f3103da2d Improve the parsing rules, avoiding eating all possible chars.
Help improving the situation for #56.
2014-07-16 23:09:11 +02:00
Dimitri Fontaine
3e0526c957 Implement early support for IXF files. 2014-07-14 21:53:50 +02:00
Dimitri Fontaine
f5c703c206 Handle camelCase column names for CSV, fix #79 again.
The previous patch didn't take into account the need to retain the case
of the PostgreSQL column names when using double-quotes in the load
command, which is now properly forwarded down in the COPY command.
2014-06-16 17:33:14 +02:00
Dimitri Fontaine
ecd4f31d12 Accept more syntaxes for fields and columns, fixes #79.
With this patch it's now possible to "quote" column names and to use
_ (underscore) as the leading character in a field or column name. Of
course it is still unnecessary to quote the column names, but handling
the PostgreSQL quoting rules can't be bad here.
2014-06-16 16:27:46 +02:00
Dimitri Fontaine
8153cecf19 Allow any clause ordering in all commands, see #56.
Generalize what the previous patch did only for the MySQL case, this
time affecting the internal parser API expectations to "flag" all
clauses return values with a per-clause keyword so that an ordinary
lambda list keyword can then be destructured.
2014-06-16 14:26:12 +02:00
Dimitri Fontaine
8770a23695 Typo fix for #56.
Of course I commited and pushed with a stupid typo...
2014-06-15 14:37:40 +02:00
Dimitri Fontaine
7db001a7c3 Allow the MySQL command parser to process clauses in any order, fix #56.
Only the MySQL command is addressed in this patch, because the code
level approach is not safisfying me completely. It might be easier to
just bite the bullet and review all the optional clauses return values
rather than add a layer as this patch does.

The feature still is available for MySQL given this patch, so let's push
it, get feedback, then see about how to make the approach scale and
revise all the other commands.
2014-06-15 14:19:38 +02:00
Dimitri Fontaine
de4ff30acc Implement --summary to copy the output to a file, fix #68.
Given than redirecting a tty such as *terminal-io* isn't easy enough,
let's provide a way to copy the summary output to a file. Another way to
solve it would have been to output the summary to the main logs, but
that could have made the logs parsing more difficult that necessary.

Let's see how users like it...
2014-06-14 23:31:11 +02:00
Ronan Dunklau
1e208ad29a Take the default password from PGPASSWORD 2014-06-10 11:45:54 +02:00
Dimitri Fontaine
a2370938b6 MATERIALIZE ALL VIEWS.
Complete the MySQL migration feature.
2014-05-26 18:03:50 +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
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
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
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
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
b758058208 Fix the fix for parsing quoted-filenames. 2014-04-28 15:18:18 +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
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
46fd6632f2 Fix #40 by providing a per-table forced-encoding option.
This patch takes benefits from the recent patch
62fc85a1cf
so that you will need to freshen your local Qmynd copy if you want to
test from sources.
2014-03-03 23:39:22 +01:00
Dimitri Fontaine
7fa95c1135 Fix bug #39 wherein unix domain sockets didn't make it properly to cl-postgres. 2014-02-24 17:23:17 +01:00
Dimitri Fontaine
dbfd8cf06c Implement new CSV option "lines terminated by", fixes #23. 2014-02-04 20:58:46 +01:00
Dimitri Fontaine
d132bafc07 Refrain from parsing a non-existing command file... 2014-01-23 23:17:34 +01:00
Dimitri Fontaine
ccb888164c Fix where to find relative filenames from within commands. 2014-01-22 17:11:01 +01:00
Dimitri Fontaine
c56bbab0c4 Fix #24 by allowing cast rules adding only transformation functions. 2014-01-20 16:00:09 +01:00
Dimitri Fontaine
6ccb1871f5 Fix parsing dotted hostnames. 2014-01-15 10:48:56 +01:00
Dimitri Fontaine
cd1d5ad597 Fix missing *pg-dbname* in CSV processing, resulting in broken logging. 2013-12-25 16:50:14 +01:00
Dimitri Fontaine
b2c9e0d2dc Refactor the whole logging infrastructure not to depend on threads sharing streams. 2013-12-24 19:08:55 +01:00
Dimitri Fontaine
fe302af221 Refactor the dbname API to feed from the connection string directly. 2013-12-20 17:24:02 +01:00
Dimitri Fontaine
49f2567b0d Improve stats on meta-data and before sections. 2013-12-20 10:50:27 +01:00
Dimitri Fontaine
e09eb3fbb2 There is always a need for a before state when migrating from MySQL... 2013-12-20 10:19:36 +01:00
Dimitri Fontaine
2019b918f0 Implement support for matching several files in a single archive clause. 2013-11-26 16:47:37 +01:00
Dimitri Fontaine
de1afc7416 Fix CSV and FIXED parsing to run the BEFORE section before doing PostgreSQL introspection. 2013-11-26 11:51:42 +01:00
Dimitri Fontaine
e4b50d2315 An archive always need a before state to be able to report about its extract step. 2013-11-24 17:09:56 +01:00
Dimitri Fontaine
ea4e74e545 Improve parsing of list separating commas wrt to whitespacing. 2013-11-23 21:49:08 +01:00
Dimitri Fontaine
4bc4cc53a7 Add support for connecting to PostgreSQL with Unix Domain Sockets, fixing #15. 2013-11-22 17:19:48 +01:00
Dimitri Fontaine
6a6684bd8b Desultory improve the SQLite importer. 2013-11-21 21:34:02 +01:00
Dimitri Fontaine
8d8e0b041a Allow filename matching expressions in the FIXED command, and support it in archives. 2013-11-18 11:38:50 +01:00
Dimitri Fontaine
b31ccded6f Implement per-column MySQL CAST rules. 2013-11-18 10:12:43 +01:00
Dimitri Fontaine
8fa7a86013 Implement typemod and default guards in the MySQL CAST clause. 2013-11-17 22:33:06 +01:00
Dimitri Fontaine
d295001a2a Review the main function to better handle per-filename-argument errors. 2013-11-17 19:02:26 +01:00
Dimitri Fontaine
718ac80560 Implement a Materiaze Views option for MySQL. 2013-11-16 21:41:07 +01:00
Dimitri Fontaine
2e3edde3ad Implement a generic API to deal with indexes, use it in MySQL and SQLite sources. 2013-11-07 22:07:00 +01:00
Dimitri Fontaine
a227943012 Fix the logging system, we now have a proper logfile. 2013-11-07 20:46:47 +01:00
Dimitri Fontaine
9d5dad7e3e Implement support for FIXED COLS input files, reaching release candidate status. 2013-11-07 15:39:28 +01:00