0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

BigQuery の特定プロジェクトの DatasetID とデータセット作成日時を出力するワンライナー

Last updated at Posted at 2024-05-23

前提

  • MacOS で zsh

実際のコマンドと出力サンプル

コマンド

$ bq ls --format prettyjson -n 100 --project_id foobar-project |
jq -r '.[].datasetReference.datasetId' |
xargs -I {} bq show --format prettyjson --project_id foobar-project -d=true {} |
jq -r '[."datasetReference"."datasetId", ."creationTime"] | @csv' |
gawk -F "," '{
    gsub(/"/, "");
    print $1 "\t" strftime("%Y-%m-%d %H:%M:%S", substr($2, 1, 10))
}'

出力サンプル(TSV)

aaa       2021-09-28 09:57:51
bbb       2020-02-12 19:24:36
ccc       2020-01-10 18:41:00
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?