bigquery中是否有类似“配置单元元存储”的元数据存储?

wz8daaqr  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(438)

我是新来的大查询。我只想知道,在bigquery中是否有类似hivemetastore(关于所有表、列及其描述的元数据)的东西?

zyfwsgd6

zyfwsgd61#

bigquery提供了一些特殊的表,其内容表示元数据,例如数据集中的表和视图列表。“元表”是只读的。要访问有关数据集中的表和视图的元数据,请在查询的select语句中使用\uuuu tables\u summary\uuuuu meta表。您可以使用bigQueryWebUI、使用命令行工具的bqquery命令或调用jobs.insert api方法并配置查询作业来运行查询。
另一个更详细的元表是\uuuuu tables\uuuuuuuu-参见下面的示例

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__`

对于表schema-列,description-可以使用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

相关问题