pgloader/test/dbf-memo.load
Dimitri Fontaine 7d2e5ae941 Allow lambda expression as cast rules using functions.
Before that it was necessary to install a function in the lisp environment
either in the source itself in src/utils/transforms.lisp, or in a lisp file
loaded with --load-lisp-file (or -l for shorts).

While this could be good enough, sometimes a very simple combination of
existing features is required to transform a function and so doing some
level of lisp coding directly in the load command is a nice to have.

Fixes #961.
2019-05-08 19:02:18 +02:00

13 lines
398 B
Fish

LOAD DBF
FROM data/DNORDOC.DBF with encoding cp866
INTO postgresql:///pgloader
TARGET TABLE public.dnordoc
WITH truncate, create table, disable triggers
cast
column dnordoc.normdocid
to uuid
using (lambda (normdocid)
(empty-string-to-null (right-trim normdocid))),
column dnordoc.doctype to integer using db3-numeric-to-pgsql-integer;