【问题标题】:Set TBLProperties using Scala API使用 Scala API 设置 TBLProperties
【发布时间】:2022-12-09 15:26:33
【问题描述】:

我正在将数据写入模式为overwrite的表中

由于我的列名中有特殊字符,因此我需要为列映射设置以下三个属性。

  • 'delta.minReaderVersion' = '2',
  • 'delta.minWriterVersion' = '5',
  • 'delta.columnMapping.mode' = 'name'

所以想知道有没有办法使用 Scala API 设置 TBLProperties?

我试过了但没有用

myDf.write.mode("Overwrite")
.option("delta.minReaderVersion", "2")
.option("delta.minWriterVersion", "5")
.option("delta.columnMapping.mode", "name")
.saveAsTable("testDB.employees")

【问题讨论】:

标签: scala apache-spark databricks


【解决方案1】:

不使用 databricks 进行测试,但试试这个可能会有帮助:

df.write.format("delta")
  .mode("overwrite")
  .option("TBLPROPERTIES", "key1=value1, key2=value2")
  .save("/path/to/table")

【讨论】:

    猜你喜欢
    • 2012-06-05
    • 2017-02-28
    • 2018-07-20
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 2011-11-25
    相关资源
    最近更新 更多