Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active December 2, 2020 13:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroyuki-sato/370ca003b410fb8a8870 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/370ca003b410fb8a8870 to your computer and use it in GitHub Desktop.
Embulk、path_prefixに日付をダイナミックに挿入する方法

conf.yml.liquid

{% capture today %}{{ 'now' | date: '%Y%m%d' }}{% endcapture %}
in:
  type: file
  path_prefix: /private/tmp/sample/csv/sample_{{ today }}
  decoders:
  - {type: gzip}
  parser:
    charset: UTF-8
    newline: CRLF
    type: csv
    delimiter: ','
    quote: '"'
    trim_if_not_quoted: false
    skip_header_lines: 1
    allow_extra_columns: false
    allow_optional_columns: false
    columns:
    - {name: id, type: long}
    - {name: account, type: long}
    - {name: time, type: timestamp, format: '%Y-%m-%d %H:%M:%S'}
    - {name: purchase, type: timestamp, format: '%Y%m%d'}
    - {name: comment, type: string}
out: {type: stdout}

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment