LoginSignup
0
0

More than 1 year has passed since last update.

BigQueryでシャーディングされたテーブルの一覧が欲しい

Last updated at Posted at 2022-02-01

BigQueryにおいて日付などでシャーディングされたテーブル群に対して、具体的にどの日付のテーブルがその中にあるのか知りたいときがあります。
この時は以下のクエリを実行することでシャーディングの中にあるテーブルを一覧として得ることができます。

SELECT * 
FROM project_name.dataset_name.__TABLES__
WHERE starts_with(table_id, '<table_prefix>') 
ORDER BY table_id

このクエリはもちろんシャーディングのみならず一般のテーブルのprefixに応用できます。

得られるクエリ結果のスキーマは以下のようになります:

field name type
project_id STRING
dataset_id STRING
table_id STRING
creation_time INTEGER
last_modified_time INTEGER
row_count INTEGER
size_bytes INTEGER
type INTEGER

参考文献

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