gpt4 book ai didi

hive - BigQuery 中是否有像 'hive metastore' 这样的元数据存储?

转载 作者:行者123 更新时间:2023-12-02 20:51:47 25 4
gpt4 key购买 nike

我是 BigQuery 新手。我只是想知道,BigQuery 中是否有类似 Hive Metastore(有关所有表、列及其描述的元数据)的东西?

最佳答案

BigQuery 提供了一些特殊表,其内容表示元数据,例如数据集中的表和 View 的列表。 “元表”是只读的。要访问有关数据集中的表和 View 的元数据,请在查询的 SELECT 语句中使用 __TABLES_SUMMARY__ 元表。您可以使用 BigQuery 网页界面、命令行工具的 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__`

对于表架构 - 列、描述 - 您可以使用 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

关于hive - BigQuery 中是否有像 'hive metastore' 这样的元数据存储?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49754064/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com