在BigQuery中有没有像'hive metastore'这样的元数据存储?

Naa*_*a A 3 hive google-bigquery hcatalog metastore

我是BigQuery的新手.我只是想知道,在BigQuery中我们是否有像hive metastore(关于所有表,列及其描述的元数据)的内容?

Mik*_*ant 6

BigQuery提供了一些特殊的表,其内容表示元数据,例如数据集中的表和视图列表."元表"是只读的.要访问有关数据集中表和视图的元数据,请在查询的SELECT语句中使用__TABLES_SUMMARY__元表.您可以使用BigQuery Web UI,使用命令行工具的bq查询命令,或通过调用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__`  
Run Code Online (Sandbox Code Playgroud)

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

bq show publicdata:samples.shakespeare  
Run Code Online (Sandbox Code Playgroud)

结果为

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

有关详情,请访问https://cloud.google.com/bigquery/bq-command-line-tool#gettable