BigQuery中是否有像'hive metastore'这样的元数据存储? [英] is there any metadata store like 'hive metastore' in BigQuery?

查看:245
本文介绍了BigQuery中是否有像'hive metastore'这样的元数据存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是BigQuery的新手。我只想知道,在BigQuery中是否有类似蜂房元数据的元数据(有关所有表,列和其描述的元数据)? 解决方案

BigQuery提供了一些特殊的表格,其内容表示元数据,例如数据集中表格和视图的列表。 元表是只读的。要访问关于数据集中表和视图的元数据,请在查询的SELECT语句中使用__TABLES_SUMMARY__元表。您可以使用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
当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 

结果为

$ $ p $ tableId最后修改的架构
-------- ----- ----------------- ---------------------------- --------
shakespeare 01 Sep 13:46:28 | - word:string(必填)
| - word_count:整数(必填)
| - 语料库:string(必填)
| - corpus_date:integer(必填)

更多信息,请参阅 https://cloud.google.com/bigquery/bq-command-line-tool#gettable


I am new to BigQuery. I just want to know, whether do we have anything like hive metastore (metadata about all tables, columns and their description) in BigQuery?

解决方案

BigQuery offers some special tables whose contents represent metadata, such as the list of tables and views in a dataset. The "meta-tables" are read-only. To access metadata about the tables and views in a dataset, use the __TABLES_SUMMARY__ meta-table in a query's SELECT statement. You can run the query using the BigQuery web UI, using the command-line tool's bq query command, or by calling the jobs.insert API method and configuring a query job.

Another more detailed meta-table is __TABLES__ - see example below

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

for table schema - columns, description - you can utilize bq command line - for example:

bq show publicdata:samples.shakespeare  

with result as

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

see more at https://cloud.google.com/bigquery/bq-command-line-tool#gettable

这篇关于BigQuery中是否有像'hive metastore'这样的元数据存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆