Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created February 24, 2015 10:04
Show Gist options
  • Select an option

  • Save hiroyuki-sato/61e5da934ccf41a258ca to your computer and use it in GitHub Desktop.

Select an option

Save hiroyuki-sato/61e5da934ccf41a258ca to your computer and use it in GitHub Desktop.
Embulk epoch timestamp test.
[1] pry(main)> Time.at(1424770450)
=> 2015-02-24 18:34:10 +0900
% cat hoge_01.csv 
192.168.10.143,192.168.10.53,1424770450
192.168.10.53,192.168.10.143,1424770450
% cat test.yml 
in:
  type: file
  path_prefix: /path/to/timetest/hoge_
  parser:
    charset: UTF-8
    newline: CRLF
    type: csv
    delimiter: ','
    quote: ''
    escape: ''
    header_line: false
    columns:
    - {name: c0, type: string}
    - {name: c1, type: string}
    - {name: c2, type: timestamp, format: "%s" }
exec: {}
out: {type: stdout}
% embulk preview  test.yml 
2015-02-24 18:58:50,577 +0900: Embulk v0.4.7
2015-02-24 18:58:51.704 +0900 [INFO] (preview): Listing local files at directory '/path/to/timetest/timetest' filtering filename by prefix 'hoge_'
2015-02-24 18:58:51.710 +0900 [INFO] (preview): Loading files [/path/to/timetest/hoge_01.csv]
+----------------+----------------+--------------------------+
|      c0:string |      c1:string |             c2:timestamp |
+----------------+----------------+--------------------------+
| 192.168.10.143 |  192.168.10.53 | 47119-03-07 17:26:40 UTC |
|  192.168.10.53 | 192.168.10.143 | 47119-03-07 17:26:40 UTC |
+----------------+----------------+--------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment