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 の特定データセットの tableId と lastModifiedTime を表示するワンライナー

Posted at

前提

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

コマンド

bq ls --format prettyjson -n 10000 --project_id foo-project bar_dataset | \
jq -r '.[].id' | \
xargs -I {} bq show --format prettyjson --project_id foo-project {} | \
jq -r '[."tableReference"."tableId", ."lastModifiedTime"] | @csv' | \
gawk -F "," '{
    gsub(/"/, "");
    print $1 "\t" strftime("%Y-%m-%d %H:%M:%S", substr($2, 1, 10))
}' 

出力サンプル(TSV)

aaa   2024-05-29 02:18:42
bbb   2024-05-29 01:46:16
ccc   2024-05-12 01:45:36
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?