在 gcs 上使用镶木地板文件创建新的外部大查询 table 时。显示错误

When creating a new big query external table with parquet files on gcs. Showing error

我试图在 gcs 上使用 parquet 文件创建一个外部大查询 table。它显示错误的格式错误。

但是使用相同的文件创建原生 table 效果很好。为什么它必须是本地人 table。

如果使用本机 table,如何将更多数据导入此 table?我不想删除和创建每次获得新数据时的 table。

任何帮助将不胜感激。

Parquet 目前不是 supported data format for federated tables。只要附加(而不是覆盖)当前内容,就可以将更多数据重复加载到同一个 table 中。

这似乎现在得到支持,at least in beta。据我所知,这只适用于 us-central1。

Simply select 'External Table' and set 'Parquet' as your file type

当前的 google 文档可能有点难以理解。这是一个两步过程,首先创建定义文件并将其用作创建 table.

的输入

正在创建定义文件,如果您正在处理未分区的文件夹

 bq mkdef \
  --source_format=PARQUET \
  "<path/to/parquet/folder>/*.parquet" > "<definition/file/path>"

否则,如果您正在处理分区的配置单元 table

bq mkdef \
  --autodetect \
  --source_format=PARQUET \
  --hive_partitioning_mode=AUTO \
  --hive_partitioning_source_uri_prefix="<path/to/hive/table/folder>" \
  "<path/to/hive/table/folder>/*.parquet" > "<definition/file/path>"

Note: path/to/hive/table/folder should not include the partition folder

Eg: If your table is loaded in format gs://project-name/tablename/year=2009/part-000.parquet

bq mkdef \
      --autodetect \
      --source_format=PARQUET \
      --hive_partitioning_mode=AUTO \
      --hive_partitioning_source_uri_prefix="gs://project-name/tablename" \
      "gs://project-name/tablename/*.parquet" > "def_file_name"

最后,table 可以通过

从定义文件创建
bq mk --external_table_definition="<definition/file/path>" "<project_id>:<dataset>.<table_name>"