File tree Expand file tree Collapse file tree
src/PowerPlatform/Dataverse/operations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,6 +242,8 @@ def update(
242242 """
243243 if not isinstance (changes , pd .DataFrame ):
244244 raise TypeError ("changes must be a pandas DataFrame" )
245+ if changes .empty :
246+ raise ValueError ("changes must be a non-empty DataFrame" )
245247 if id_column not in changes .columns :
246248 raise ValueError (f"id_column '{ id_column } ' not found in DataFrame columns" )
247249
Original file line number Diff line number Diff line change @@ -290,6 +290,14 @@ def test_update_empty_change_columns(self):
290290 self .client .dataframe .update ("account" , df , id_column = "accountid" )
291291 self .assertIn ("No columns to update" , str (ctx .exception ))
292292
293+ def test_update_empty_dataframe_raises (self ):
294+ """Empty DataFrame raises ValueError without calling the API."""
295+ df = pd .DataFrame (columns = ["accountid" , "name" ])
296+ with self .assertRaises (ValueError ) as ctx :
297+ self .client .dataframe .update ("account" , df , id_column = "accountid" )
298+ self .assertIn ("non-empty" , str (ctx .exception ))
299+ self .client ._odata ._update .assert_not_called ()
300+
293301 def test_update_clear_nulls_false (self ):
294302 """NaN values are omitted from the update payload when clear_nulls=False."""
295303 df = pd .DataFrame ([{"accountid" : "guid-1" , "name" : "New Name" , "telephone1" : None }])
You can’t perform that action at this time.
0 commit comments