使用命令行在BigQuery中使用蜂巢分区信息从GCS创建外部表

问题描述 投票:1回答:1

我在Google云存储中具有以下命名层次结构的存储桶。

gs://<bucket>/events/year=2020/month=03/day=23/hour=12

我已使用以下命令创建了一个包含配置单元分区信息的BigQuery本机表,以便从Google云端存储导入。这有效。

bq load --project_id=<projectId> --source_format=NEWLINE_DELIMITED_JSON --autodetect --hive_partitioning_mode=AUTO --hive_partitioning_source_uri_prefix=gs://<bucket>/events/ <targetTableName> "gs://<bucket>/events/*" "<schema>"

并且以下查询也有效。

SELECT * from table WHERE year=2020

但是,当我尝试对外部表执行相同操作时,将使用配置单元分区信息创建表。但是查询无法识别任何分区。

bq mkdef --source_format=NEWLINE_DELIMITED_JSON --autodetect --hive_partitioning_mode=AUTO --hive_partitioning_source_uri_prefix="gs://<bucket>/events" --require_hive_partition_filter=True "gs://<bucket>/events/*" > <table_Def>

bq mk --dataset_id=<datasetId> --data_source=google_cloud_storage --external_table_definition=<tableDef> --schema=<schema> --table <tableName>

并且以下查询不起作用。

SELECT * from table WHERE year=2020

文档指出,应支持此功能。有人可以告诉我我在这里想念的东西吗?

google-bigquery
1个回答
0
投票
我们有类似的问题,Google目前正在解决一个错误。您可以检查状态here
© www.soinside.com 2019 - 2024. All rights reserved.