Scio saveAsTypedBigQuery写入分区以获取Typed Big Query案例类的SCollection

时间:2022-06-22 14:18:22

I'm trying to write a SCollection to a partition in Big Query using:

我正在尝试使用以下方法将Scollection写入Big Query中的分区:

import java.time.LocalDate
import java.time.format.DateTimeFormatter
val date = LocateDate.parse("2017-06-21")
val col = sCollection.typedBigQuery[Blah](query)

col.saveAsTypedBigQuery(
      tableSpec = "test.test$" + date.format(DateTimeFormatter.ISO_LOCAL_DATE),
      writeDisposition = WriteDisposition.WRITE_EMPTY,
      createDisposition = CreateDisposition.CREATE_IF_NEEDED)

The error I get is Table IDs must be alphanumeric (plus underscores) and must be at most 1024 characters long. Also, Table decorators cannot be used."

我得到的错误是表ID必须是字母数字(加上下划线),并且最多不得超过1024个字符。此外,不能使用表装饰器。“

How can I write to a partition? I don't see any options to specify partitions via either saveAsTypedBigQuery method so I was trying the Legacy SQL table decorators.

如何写入分区?我没有看到任何通过saveAsTypedBigQuery方法指定分区的选项,所以我尝试了Legacy SQL表装饰器。

1 个解决方案

#1


0  

See: BigqueryIO Unable to Write to Date-Partitioned Table. You need to manually create the table. BQ IO cannot create a table and partition it.

请参阅:BigqueryIO无法写入日期分区表。您需要手动创建表。 BQ IO无法创建表并对其进行分区。

Additionally, the no table decorators was a complete ruse. It's the alphanumeric part I was missing.

此外,没有表装饰器是一个完整的诡计。这是我失踪的字母数字部分。

col.saveAsTypedBigQuery(
      tableSpec = "test.test$" + date.format(DateTimeFormatter.BASIC_ISO_DATE),
      writeDisposition = WriteDisposition.WRITE_APPEND,
      createDisposition = CreateDisposition.CREATE_NEVER)

#1


0  

See: BigqueryIO Unable to Write to Date-Partitioned Table. You need to manually create the table. BQ IO cannot create a table and partition it.

请参阅:BigqueryIO无法写入日期分区表。您需要手动创建表。 BQ IO无法创建表并对其进行分区。

Additionally, the no table decorators was a complete ruse. It's the alphanumeric part I was missing.

此外,没有表装饰器是一个完整的诡计。这是我失踪的字母数字部分。

col.saveAsTypedBigQuery(
      tableSpec = "test.test$" + date.format(DateTimeFormatter.BASIC_ISO_DATE),
      writeDisposition = WriteDisposition.WRITE_APPEND,
      createDisposition = CreateDisposition.CREATE_NEVER)