नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Merges a set of updates, insertions, and deletions based on a source table into a target table.
Syntax
mergeInto(table: str, condition: Column)
Parameters
| Parameter | Type | Description |
|---|---|---|
table |
str | Target table name to merge into. |
condition |
Column | The condition that determines whether a row in the target table matches one in the source DataFrame. |
Returns
MergeIntoWriter: MergeIntoWriter to use further to specify how to merge the source DataFrame into the target table.
Examples
from pyspark.sql.functions import expr
source = spark.createDataFrame(
[(14, "Tom"), (23, "Alice"), (16, "Bob")], ["id", "name"])
(source.mergeInto("target", "id")
.whenMatched().update({ "name": source.name })
.whenNotMatched().insertAll()
.whenNotMatchedBySource().delete()
.merge())