Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active July 9, 2020 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroyuki-sato/adfd13458a7c645ba8457a3f3a0d2430 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/adfd13458a7c645ba8457a3f3a0d2430 to your computer and use it in GitHub Desktop.
embulk-input-postgresql`のtimestamp without time zoneカラムの動作

embulk-input-postgresqlのtimestamp without time zoneカラムの動作

  • postgrsql.conf内に書いたtimezoneの影響は受けない
  • embulkを実行するホストのタイムゾーンに影響する
create table timezone_test (
  id int not null,
  name varchar(255) not null,
  updated_at timestamp without time zone
);

insert into timezone_test (id,name,update_at) 
  values (1,'test1','2020-07-09 00:00');
in:
  type: postgresql
  user: user
  password: xxxx
  host: localhost
  database: embulk_test
  table: timezone_test

out:
  type: stdout
  • 2020-07-08 15:00:00 UTC -> 2020-07-09 00:00:00 +0900
# timezone Asia/Tokyo
embulk preview conf.yml
+---------+-------------+-------------------------+
| id:long | name:string |    updated_at:timestamp |
+---------+-------------+-------------------------+
|       1 |       test1 | 2020-07-08 15:00:00 UTC |
+---------+-------------+-------------------------+

Force set timezone to UTC

TZ=UTC embulk preview conf.yml
+---------+-------------+-------------------------+
| id:long | name:string |    updated_at:timestamp |
+---------+-------------+-------------------------+
|       1 |       test1 | 2020-07-09 00:00:00 UTC |
+---------+-------------+-------------------------+

環境

  • Java: 1.8.0_251
  • embulk: 0.9.23
  • embulk-input-postgresql: 0.10.1
  • OS: macOS 10.15.5
  • PostgreSQL: 12.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment