Commit Graph

790 Commits

Author SHA1 Message Date
Dimitri Fontaine
087d4d28cb Review website material, introduce pgloader cli operations. 2015-01-15 16:52:10 +01:00
Dimitri Fontaine
560c838d34 Improve documentation, readying for next release.
The docs now fully cover all supported source types, including COPY and
MSSQL, and expand some more on the command-line only operations for
pgloader.
2015-01-15 00:29:41 +01:00
Dimitri Fontaine
2dfb0269a4 Depend on current cl-csv master's version to fix #123.
The bug is related to the processing of empty-lines in the middle of
quoted text by cl-csv, which state machine has gotten quite complex to
be able to handle all the crazy different csv variants out there.

Testing shows the bug is fixed in pgloader by just updating cl-csv.
2015-01-14 23:39:01 +01:00
Dimitri Fontaine
290916b0f0 Attempt at fixing --self-upgrade.
The option currently only works within the same build environment where
the image was first build, as noted in #133. This is an attempt at
convincing ASDF not to load systems that pgloader depends on in order to
be able to load only the new pgloader definition.

While it looks sound in principle, I failed to have it work in the lab.
Given that previous to this patch nothing works at all, it's not a
regression, let's push it as is makes the code saner.

Also, it looks like asdf::*immutable-systems* is what we want here, but
that's asdf 3.1.x and we're not there yet.
2015-01-14 20:54:11 +01:00
Dimitri Fontaine
9f45b9864a Implement support for update and delete rules for MysQL FKeys, fixes #141. 2015-01-14 18:35:48 +01:00
Eric Jiang
47aa02d844 Add unix-timestamp-to-timestamptz transform. 2015-01-14 18:05:53 +01:00
Dimitri Fontaine
b403c40d30 Implement support for MySQL comments, fix #126.
Only table (BASE TABLE) and columns comments are supported now. I didn't
even try to see if more are possible and interesting to support.
2015-01-09 01:49:56 +01:00
Dimitri Fontaine
cd46b6cbed Clean up common code for sources.
Only move code around, creating a src/sources/common directory with
several files in there so as to split the too big src/sources.lisp.
2015-01-08 23:17:40 +01:00
Dimitri Fontaine
7fcee2617d Fix hooks.lisp to have SBCL extensions #+sbcl protected. 2015-01-08 09:30:24 +01:00
Dimitri Fontaine
5f520737e6 Improve loading of external libs, fixes #142.
Loading external libs at application startup time is not convenient as
it forces users to install freetds everywhere even when they don't need
it. This patch makes it so that freetds is only loaded when pgloader is
asked to load from a MS SQL database source.

Note that we could have done the same for SSL if it wasn't possibly used
to connect to PostgreSQL, which isn't optional in current pgloader
implementation.
2015-01-07 22:23:12 +01:00
Dimitri Fontaine
9da649d028 Typo fix. 2015-01-06 12:36:22 +01:00
Dimitri Fontaine
2caefb0836 Fix and improve new summary reporting. 2015-01-06 12:36:14 +01:00
Dimitri Fontaine
559e1c3348 Forgot to push the changes to the manpage. 2015-01-06 12:35:35 +01:00
Dimitri Fontaine
ad8fb0b2a4 Implement machine readable summary files, fixes #144.
It's now possible to have pgloader print out its summary in one of
several formats: human-readable (default), csv, copy or json. The
choice of format is made depending on the extension of the summary
filename picked on the command line with the option --summary.
2015-01-06 01:22:01 +01:00
Dimitri Fontaine
d9f5bff5e0 Cleanup some code location. 2015-01-06 01:18:54 +01:00
Dimitri Fontaine
a86369a03d Improve the CLI situation a bit.
Fix bugs related to parsing the new COPY type, and make it so that we
know how to parse options (and fields, and other type dependant things)
even when --type is missing, in care the source URL has the information.
2015-01-06 00:07:31 +01:00
Dimitri Fontaine
e1bc6425e2 Implement support for PostgreSQL COPY format, fix #145.
PostgreSQL COPY format is not really CSV but something way easier to
parse. Funnily enough, parsing it as CSV is not that easy, so we add
here a special simple parser for the COPY format.

It should be quite useful too try loading again reject data files from
pgloader after manual fixing, too. It's still missing some documentation
without any good excuse for that, will add soon.
2015-01-02 18:49:17 +01:00
Dimitri Fontaine
6d76bc57e3 Allow - from the command line to process from standard input.
Also augment the documentation with examples of bare stdin reading and
of advantages of the unix pipes to stream even remove archived content
down to PostgreSQL.
2014-12-27 21:20:40 +01:00
Dimitri Fontaine
f2bf5c4a62 Adjusting manpage text to fit github's markdown... 2014-12-27 17:09:37 +01:00
Dimitri Fontaine
44504542c9 Small fixes in the pgloader.1.md documentation. 2014-12-27 17:08:17 +01:00
Dimitri Fontaine
40f3c4f769 Improve HTTP handling of CSV and Fixed data sources.
In passing also allow --field to specify the whole field list, there's
no point in forcing the user to have as many --field switches on the
command line as they have columns in their data source file.
2014-12-27 17:02:19 +01:00
Dimitri Fontaine
25c39b05e2 Tidying up some more. 2014-12-27 00:30:10 +01:00
Dimitri Fontaine
e25ccdb531 Fix ixf default transform to use princ-to-string.
Also, simplify away the use of compile here.
2014-12-26 23:00:58 +01:00
Dimitri Fontaine
65b35cf4a1 Fix bug with db3 options handling. 2014-12-26 22:43:44 +01:00
Dimitri Fontaine
b3a09a20e3 Further simplifications from stassats. 2014-12-26 22:33:15 +01:00
Dimitri Fontaine
f922392341 Simplify some loop constructs, per stassats gripe. 2014-12-26 22:13:25 +01:00
Dimitri Fontaine
13992121b3 Export more utilities in the pgloader package.
That makes like of other CL users wanted to play with pgloader way easier.
2014-12-26 22:00:22 +01:00
Dimitri Fontaine
302a7d402b Refactor connection handling, and clean-up many things.
That's the big refactoring patch I've been sitting on for too long.

First, refactor connection handling to use a uniformed "connection"
concept (class and generic functions API) everywhere, so that the COPY
derived objects just use that in their :source-db and :target-db slots.

Given that, we don't need no messing around with *pgconn* and *myconn-*
and other special variables at all anywhere in the tree.

Second, clean up some oddities accumulated over time, where some parts
of the code didn't get the memo when new API got into place.

Third, fix any other oddity or missing part found while doing those
first two activities, it was long overdue anyway...
2014-12-26 21:50:29 +01:00
Dimitri Fontaine
e45ab7f1e2 Add an EXAMPLES section to the man page. 2014-12-23 22:37:26 +01:00
Dimitri Fontaine
3654f73390 Bugfix some db3 and dbf confusion, and review defaults for dbf loading. 2014-12-23 22:36:54 +01:00
Dimitri Fontaine
3362a1da19 Improve source and target uri parsing.
In particular, make dbf and db3 synonyms as far as --type is concerned.
2014-12-23 17:32:55 +01:00
Dimitri Fontaine
cd0b7b4240 Remove the FreeTDS dbbuffer setting.
In current testing it's counter-productive and introduces surprising bugs.
2014-12-23 15:38:19 +01:00
Dimitri Fontaine
6eac0d9dd8 Implement --before and --after options on the command line.
That allows using SQL scripts to run before and after the main data
processing and loading done by pgloader when used only from the command
line.
2014-12-23 12:21:44 +01:00
Dimitri Fontaine
65c2043694 Improve pgloader usage from the command line.
Make it so that the following command line usages are accepted when
using pgloader without a command file:

 ./build/bin/pgloader ./test/sqlite/sqlite.db postgresql:///pgloader

 ./build/bin/pgloader --set "search_path='sakila'"  \
                      mysql://root@localhost/sakila \
                 postgresql:///sakila

 ./build/bin/pgloader --type csv                             \
                      --field id --field field               \
                      --with truncate                        \
                      --with "fields terminated by ','"      \
                      ./test/data/matching-1.csv             \
                      postgres:///pgloader?matching

It's now possible in most cases to just use command-line options, which
should make the entry bar to pgloader much lower.
2014-12-23 02:40:13 +01:00
Dimitri Fontaine
34b9a908b0 Fix parsing of include and exclude patterns.
By reusing the same symbols in parsers/command-m[sy]sql.lisp the parser
was broken, keep using unique symbol names for different concepts...
2014-12-22 23:00:23 +01:00
Dimitri Fontaine
8c6ccb7453 Get rid of with-database-uri.
The macro wasn't updated for the *pgconn* refactoring anyway...
2014-12-22 19:52:16 +01:00
Dimitri Fontaine
f048e36838 Attempt to set a proper FreeTDS buffer size.
Let's see what happens in the tests with that before cleaning up the API
a little here, and maybe getting rid of the hardcoded "25000" rows.
2014-12-22 19:25:24 +01:00
Dimitri Fontaine
f323625738 Improve MS SQL error handling when reading from source.
In particular, protect the sysdb-data-to-lisp routine, that calls into
CFFI and character decodings, with a restart-case allowing the calling
code to just ignore errors on a particular column by skipping it and
using nil instead (or something else if needed).
2014-12-22 18:32:11 +01:00
Dimitri Fontaine
46be4a58b7 Implement INCLUDING and EXCLUDING ... IN SCHEMA for MS SQL. 2014-12-22 17:18:29 +01:00
Dimitri Fontaine
9c6f78bff0 Stop debugging set-table-oids. 2014-12-22 17:16:42 +01:00
Dimitri Fontaine
77e11416a3 Fix MS SQL protocol handling of bigint.
Actually, fix pgloader not to depend on MS SQL specifics for bigints in
the protocol. Depending on the protocol version in the driver's setup,
MS SQL would send bigints either as floats on the wire, loosing range,
or as something else entirely which values do not match with what's in
the database actually.

Here we just convert the values to NUMERIC by using a CAST expression
directly in the query, so that the protocol only see NUMERIC and
everyone is happy. Or should be. Let's try that.
2014-12-22 11:04:01 +01:00
Dimitri Fontaine
1a083af950 Fix MS SQL decimal conversion.
Register decimal data type in MS SQL to use the float-to-string
transformation function.
2014-12-19 15:05:01 +01:00
Dimitri Fontaine
03b77fd1ad Turns out that 'dbo' is the default schema in MS SQL.
We want and need to migrate the objects in there!
2014-12-19 14:52:59 +01:00
Dimitri Fontaine
f20d7cb452 Some more cleanup after the *pgconn* refactoring. 2014-12-19 14:41:49 +01:00
Dimitri Fontaine
5b726e47a0 Improve error reporting on connection error. 2014-12-19 14:24:35 +01:00
Dimitri Fontaine
4760934cab Merge pull request #140 from mtyson01/mysql_tinyint
Add support for MySQL tinyint auto increment
2014-12-18 15:23:08 +01:00
Matt Tyson
56aa447cdf Add support for MySQL tinyint auto increment 2014-12-18 09:06:20 +10:00
Dimitri Fontaine
47c22776f2 Cleanup and fix yesterday's refactoring of pgconn parameters. 2014-12-17 11:35:10 +01:00
Dimitri Fontaine
85cff5f993 Update the manpage from its source. 2014-12-17 10:12:40 +01:00
Dimitri Fontaine
a63a4e8e61 Merge pull request #139 from dmison/patch-1
command synopsis wasn't rendering in github preview
2014-12-17 10:10:37 +01:00