File: csv-temp.load

package info (click to toggle)
pgloader 3.3.2%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,764 kB
  • ctags: 1,378
  • sloc: lisp: 11,210; makefile: 343; sh: 75; sql: 55
file content (29 lines) | stat: -rw-r--r-- 595 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
--
-- See https://github.com/dimitri/pgloader/issues/297
--
-- The "t" field would be "temperature", for instance.
--

LOAD CSV
    FROM inline (a, b, nil, t)
    INTO postgresql:///pgloader?temp(a,b,nil,t)

    WITH fields terminated by ';'

  BEFORE LOAD DO
  $$ drop table if exists temp; $$,
  $$ CREATE TABLE temp
      (
       a   integer,
       b   timestamp without time zone,
       nil real,
       t   real
      );
  $$;


100;2015-01-01 00:00:00;-6;10
101;2015-01-02 00:00:00;-2.1;12.5
102;2015-01-03 00:00:00;3.4;5.5
103;2015-01-04 00:00:00;4.7;-2.3
104;2015-01-05 00:00:00;0.4;0