如何覆盖 awsglue 中的数据?

Che*_*rry 5 scala amazon-s3 amazon-web-services aws-glue

考虑一个代码:

val inputTable = glueContext
  .getCatalogSource(database = "my_db", tableName = "my_table)
  .getDynamicFrame()

glueContext.getSinkWithFormat(
  connectionType = "s3",
  options = JsonOptions(Map("path" -> "s3://my_out_path")),
  format = "orc", transformationContext = ""
).writeDynamicFrame(inputTable)
Run Code Online (Sandbox Code Playgroud)

当我运行此代码两次时,新orc文件将添加到 "s3://my_out_path". 有没有办法覆盖始终覆盖路径?

笔记

写入数据没有分区。

Aid*_*nez 1

是的,您可以使用spark来覆盖内容。您仍然可以使用 Glue 方法读取数据,但随后将其更改为 Spark 数据帧并覆盖文件:

datasink = DynamicFrame.toDF(inputTable)
datasink.write.\
            format("orc").\
            mode("overwrite").\
            save("s3://my_out_path")
Run Code Online (Sandbox Code Playgroud)