簡體   English   中英

可以使用 Apache Hudi 將一行從 Apache Spark dataframe 插入 Postgres 數據庫嗎?

[英]Can Apache Hudi be used to upsert a row from Apache Spark dataframe into Postgres database?

問題陳述:Apache Spark 中沒有對數據庫的更新插入功能,而是我們必須覆蓋整個表。 但是 Apache Hudi 可用於在不覆蓋整個表的情況下向表中插入一行或多行。

我了解 Apache Hudi 是可以與 S3 一起使用的表/文件格式。 但它也可以與 Postgresdb 或 MySql 或 Oracledb 一起使用嗎?

Hudi 在 HCFS(Hadoop Compatible File System)上管理數據集的存儲層,答案是否定的,Hudi 無法管理 Postgresdb、MySql 和 Oracledb 表,因為它們不是 HCFS,而且永遠不會。

Instead, and where the jdbc DataFrameWriter can only append to existing table or overwrite it, you can use foreach or foreachPartition to call a function which create a jdbc connection (based on the language you want to use), and upsert the data in the table .

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM