File: hans.goeuro.load

package info (click to toggle)
pgloader 3.6.10-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,060 kB
  • sloc: sql: 32,321; lisp: 14,793; makefile: 435; sh: 85; python: 26
file content (49 lines) | stat: -rw-r--r-- 1,665 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
LOAD DATABASE
     FROM      mysql://root@unix:/tmp/mysql.sock:/goeuro
     INTO postgresql://dim@unix:/tmp:/godollar

 -- INCLUDING ONLY TABLE NAMES MATCHING ~/sizes/
 EXCLUDING TABLE NAMES MATCHING ~/encoding/

 DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf-8

  SET maintenance_work_mem to '1 GB'

 CAST type datetime to timestamptz drop default drop not null using zero-dates-to-null,
      type date drop not null drop default using zero-dates-to-null,
      type timestamp to timestamptz drop not null using zero-dates-to-null,

      -- now the default for tinyint(1)
      -- column bools.a to boolean drop typemod using tinyint-to-boolean,

      -- override char(1) to varchar(1), just use char(1) here.
      type char when (= precision 1) to char keep typemod,

      -- bit(1) is a boolean too!
      -- it's a default setting, just shows how to type it in
      type bit when (= precision 1) to boolean drop typemod using bits-to-boolean,

      column ascii.s using byte-vector-to-bytea,
      column enumerate.foo using empty-string-to-null,

      column ip.ip_address to inet keep not null drop typemod,

      type decimal when (= precision 1) to boolean drop typemod,

      -- type varbinary to text drop typemod using babel:octets-to-string
      type varbinary to text drop typemod using varbinary-to-string

 MATERIALIZE VIEWS nonexisting,
   d as $$
       select cast(d as date) as d, count(*) as n
         from plop
        where d > '2013-10-02'
     group by cast(d as date);
   $$

 WITH include drop,
      create tables,
      create indexes,
      preserve index names,
      reset sequences,
      disable triggers;