@@ -718,6 +718,7 @@ def upsert(
718718 when_matched_update_all : bool = True ,
719719 when_not_matched_insert_all : bool = True ,
720720 case_sensitive : bool = True ,
721+ null_safe_eq : bool = False ,
721722 branch : str | None = MAIN_BRANCH ,
722723 snapshot_properties : dict [str , str ] = EMPTY_DICT ,
723724 ) -> UpsertResult :
@@ -732,6 +733,7 @@ def upsert(
732733 when_not_matched_insert_all: Bool indicating new rows to be inserted that do not match any
733734 existing rows in the table
734735 case_sensitive: Bool indicating if the match should be case-sensitive
736+ null_safe_eq: Bool indicating if the equality operator should be null-safe (<=> instead of =)
735737 branch: Branch Reference to run the upsert operation
736738 snapshot_properties: Custom properties to be added to the snapshot summary
737739
@@ -824,7 +826,7 @@ def upsert(
824826 # values have actually changed. We don't want to do just a blanket overwrite for matched
825827 # rows if the actual non-key column data hasn't changed.
826828 # this extra step avoids unnecessary IO and writes
827- rows_to_update = upsert_util .get_rows_to_update (df , rows , join_cols )
829+ rows_to_update = upsert_util .get_rows_to_update (df , rows , join_cols , null_safe_eq = null_safe_eq )
828830
829831 if len (rows_to_update ) > 0 :
830832 # build the match predicate filter
@@ -1320,6 +1322,7 @@ def upsert(
13201322 when_matched_update_all : bool = True ,
13211323 when_not_matched_insert_all : bool = True ,
13221324 case_sensitive : bool = True ,
1325+ null_safe_eq : bool = False ,
13231326 branch : str | None = MAIN_BRANCH ,
13241327 snapshot_properties : dict [str , str ] = EMPTY_DICT ,
13251328 ) -> UpsertResult :
@@ -1334,6 +1337,7 @@ def upsert(
13341337 when_not_matched_insert_all: Bool indicating new rows to be inserted that do not match any
13351338 existing rows in the table
13361339 case_sensitive: Bool indicating if the match should be case-sensitive
1340+ null_safe_eq: Bool indicating if the equality operator should be null-safe (<=> instead of =)
13371341 branch: Branch Reference to run the upsert operation
13381342 snapshot_properties: Custom properties to be added to the snapshot summary
13391343
@@ -1368,6 +1372,7 @@ def upsert(
13681372 when_matched_update_all = when_matched_update_all ,
13691373 when_not_matched_insert_all = when_not_matched_insert_all ,
13701374 case_sensitive = case_sensitive ,
1375+ null_safe_eq = null_safe_eq ,
13711376 branch = branch ,
13721377 snapshot_properties = snapshot_properties ,
13731378 )
0 commit comments