nxcals.api.custom.data.services.DataFrame.mergeInto
- DataFrame.mergeInto(table: str, condition: Column) MergeIntoWriter
Merges a set of updates, insertions, and deletions based on a source table into a target table.
Added in version 4.0.0.
- Parameters:
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 to use further to specify how to merge the source DataFrame into the target table.
- Return type:
MergeIntoWriter
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())
Notes
This method does not support streaming queries.