BigQuery 中是否有类似 'hive metastore' 的元数据存储?



我是BigQuery的新手。我只想知道,我们是否有诸如Hive Metastore(有关所有桌子,列及其描述的元数据(中的任何东西?

bigquery提供了一些特殊表,其内容代表元数据,例如数据集中的表和视图列表。"元表"是只读的。要在数据集中访问有关表和视图的元数据,请在查询的Select语句中使用__Tables_summary__ meta-table。您可以使用BigQuery Web UI,使用命令行工具的BQ Query命令或调用Jobs.Insert API方法并配置查询作业来运行查询。

另一个更详细的元表是__ -Tables __-请参阅下面的示例

    SELECT table_id,
        DATE(TIMESTAMP_MILLIS(creation_time)) AS creation_date,
        DATE(TIMESTAMP_MILLIS(last_modified_time)) AS last_modified_date,
        row_count,
        size_bytes,
        CASE
            WHEN type = 1 THEN 'table'
            WHEN type = 2 THEN 'view'
            WHEN type = 3 THEN 'external'
            ELSE '?'
        END AS type,
        TIMESTAMP_MILLIS(creation_time) AS creation_time,
        TIMESTAMP_MILLIS(last_modified_time) AS last_modified_time,
        dataset_id,
        project_id
    FROM `project.dataset.__TABLES__`  

用于表格模式 - 列,描述 - 您可以使用BQ命令行 - 例如:

bq show publicdata:samples.shakespeare  

结果为

 tableId      Last modified                  Schema
 ------------- ----------------- ------------------------------------
 shakespeare   01 Sep 13:46:28   |- word: string (required)
                                 |- word_count: integer (required)
                                 |- corpus: string (required)
                                 |- corpus_date: integer (required)

请参阅https://cloud.google.com/bigquery/bq-command-line-tool#gettable

最新更新