Commit Graph

1568 Commits

Author SHA1 Message Date
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
Dimitri Fontaine
17c38179cf Merge pull request #136 from mtyson01/mysql_mediumint
Add support for MySQL mediumint auto increment
2014-12-17 10:09:40 +01:00
Darrin Mison
9a7000d1be command synopsis wasn't rendering in github preview
drive-by PR ;-)
2014-12-17 14:06:46 +10:00
Dimitri Fontaine
87f8e2392e Cleanup a double pg-setting setting.
That is now taken care of in the main query macros.
2014-12-16 18:46:07 +01:00
Dimitri Fontaine
073f012d1a Add support for SSL modes in the PG connection string, fix #137.
In passing, refactor the *pgconn- dynamic bindings in favor of directly
using the connection property list straight from the connection string
parser, processing it when necessary. That allows to make it simple to
add an internal :use-ssl property.
2014-12-16 18:45:43 +01:00
Matt Tyson
dfc5c17c63 Add support for MySQL mediumint auto increment 2014-12-16 16:40:15 +10:00
Dimitri Fontaine
1996256f8f Add support for postgres:// URI prefixes, fix #135. 2014-12-15 20:32:49 +01:00
Dimitri Fontaine
1b859d269c When migrating from MySQL, add columns names to the COPY command. Fixes #132. 2014-12-12 15:12:54 +01:00
Dimitri Fontaine
3cbaea52f5 Fix pgsql uri parsing for empty hosts.
Don't use and empty string as a valid hostname, we want either the
default unix socket or "localhost" to be used in that case.
2014-12-12 15:10:46 +01:00
Dimitri Fontaine
9fb03d2d2e Update doc files for build dependencies, fix #131. 2014-12-03 00:55:32 +01:00
Dimitri Fontaine
8dbb1fe9be Fix bug introduced in f263d1b2a4, fix #124. 2014-12-02 15:05:10 +01:00
Dimitri Fontaine
b9e26ea460 Add instructions to build a docker image for pgloader.
The current instructions build SBCL then pgloader all from sources in a
debian VM. It might be a good idea to maintain a debian+SBCL docker
image and build pgloader on top of that.
2014-11-30 18:52:35 +01:00
Dimitri Fontaine
cd52654e3d Transfer processing threads errors to the main thread, fix #130.
Handling the errors within the thread is useful when debugging pgloader
interactively, but not so much when started from the command line, where
it would hand the program forever with threads waiting for interactive
debugger actions to be taken, with no way for the user to actually take
action.
2014-11-27 00:05:12 +01:00
Dimitri Fontaine
d4cab3a81e Fix MSSQL index and foreign key names.
First, the index names in MS SQL, as in MySQL, are only unique per
table, whereas they need to be globally unique (per database) in
PostgreSQL. So reuse the infrastructure we had for MySQL here.

Second, the way we trick table names in index and fkey structures means
that we already did quote the names and we don't want to quote them
again, so add a new possible *identifier-case* value to handle the case
where nothing is to be done, pretty please.
2014-11-25 00:42:37 +01:00
Dimitri Fontaine
6240202c99 Avoid the 'dbo' schema in retrieving FKeys from MS SQL. 2014-11-24 23:46:43 +01:00
Dimitri Fontaine
f263d1b2a4 Implement Foreign Key support for MSSQL.
Piggyback as much as possible on the work already done for MySQL.
2014-11-24 23:42:19 +01:00
Dimitri Fontaine
38acce57b5 Fix parsing MSSQL options, which are actually MySQL options. 2014-11-24 23:41:20 +01:00
Dimitri Fontaine
e72325ee25 Improve Index build concurrency.
Rather than doing ALTER TABLE directly, use CREATE UNIQUE INDEX in the
all in parallel concurrent index build per table, and only in the end
game "upgrade" that unique index into a PRIMARY KEY using ALTER TABLE.

The reason why it's a good idea to do that is to avoid an ACCESS
EXCLUSIVE LOCK at ALTER TABLE time, which is killing our index build
concurrency.
2014-11-24 22:05:22 +01:00
Dimitri Fontaine
6d572be186 Add build-time hints to use proper dependencies.
We got unsync again with the qmynd driver (see #124) and the WIP branch
of esrap has been in the works for a long time now. We now manually
fetch the "proper" version of those.
2014-11-23 21:27:39 +01:00
Dimitri Fontaine
a8398c20ba Implement support for migrating MS SQL Indexes. 2014-11-22 02:02:44 +01:00
Dimitri Fontaine
5ab0831d4e Allow building pgloader even when the git command fails, fix #125. 2014-11-22 00:32:29 +01:00
Dimitri Fontaine
5ce92492ce Cast MySQL default values in some cases, fixing #124.
When querying the default values of MySQL tables against MySQL catalogs,
the default value is always returned as a string. When the column having
the default actually is a "binary" column, we want the transformation
functions to receive a proper vector of bytes.

This patch adds some hard-coded rules to be smarted about the situation
for columns of type "binary".
2014-11-22 00:04:34 +01:00
Dimitri Fontaine
5b87b1a85e Refactor *identifier-case* option into a dynamic binding.
That makes it much easier to use from about anywhere in the code, which
is what is needed. In passing, fix #129.
2014-11-21 23:32:02 +01:00