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

标签 hive google-bigquery hcatalog metastore

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

最佳答案

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/48674811/

相关文章:

hive - 从hive中的子查询中获取值

google-bigquery - 是否可以在Google bigquery中检索扩展的查询历史记录或完整的查询历史记录?

google-bigquery - 仅在写入表时发生 BigQuery 内部错误或资源超出

hadoop - Vertica HCatalog连接器是否支持非标准Hive的StorageHandler?

hadoop - 使用Serde在Hive-0.14中进行简单的JSON文件分析

java - 日期递增的 Hive UDF

hadoop - 在S3上创建Hive外部表将引发 “org.apache.hadoop.fs.s3a.S3AFileSystem not found”异常

python - 配置单元:python UDF提供 “Hive Runtime Error while closing operators”

google-maps - 创建多维度交互图的工具推荐

hadoop - 在Hive中添加表遇到HCatClient错误