LoginSignup
5
1

More than 5 years have passed since last update.

Bigqueryデータセットのメタデータ確認とか

Last updated at Posted at 2019-02-08

Bigquery のテーブルごとのサイズを調べる必要が出てメタデータを確認したい事があったのだが、
時間が UnixTime になっていて、JSTに直すの少し詰まってしまった。

同じ事をまたやりそうなのでメモしておく。

テーブル
SELECT
  project_id,
  dataset_id,
  table_id,
--  datetime_add(datetime(TIMESTAMP_MILLIS(creation_time)), interval 9 hour) AS creation_time_JST,
  FORMAT_TIMESTAMP("%F %T", TIMESTAMP_MILLIS(creation_time), "Asia/Tokyo") AS creation_time_UST, 
--  datetime_add(datetime(TIMESTAMP_MILLIS(last_modified_time)), interval 9 hour) AS last_modified_time_JST,
  FORMAT_TIMESTAMP("%F %T", TIMESTAMP_MILLIS(last_modified_time), "Asia/Tokyo") AS last_modified_time_JST, 
  row_count,
  size_bytes
FROM `データセット.__TABLES__`
;

参考

5
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1