enkidulan commented on code in PR #810:
URL: https://github.com/apache/iceberg-python/pull/810#discussion_r1635675320


##########
pyiceberg/table/__init__.py:
##########
@@ -474,6 +474,26 @@ def add_files(self, file_paths: List[str], 
snapshot_properties: Dict[str, str] =
             for data_file in data_files:
                 update_snapshot.append_data_file(data_file)
 
+    def add_files_overwrite(self, file_paths: List[str], snapshot_properties: 
Dict[str, str] = EMPTY_DICT) -> None:
+        """
+        Shorthand API for adding files as data files and overwriting the table.
+
+        Args:
+            file_paths: The list of full file paths to be added as data files 
to the table
+            snapshot_properties: Custom properties to be added to the snapshot 
summary
+
+        Raises:
+            FileNotFoundError: If the file does not exist.
+        """
+        if self._table.name_mapping() is None:
+            self.set_properties(**{TableProperties.DEFAULT_NAME_MAPPING: 
self._table.schema().name_mapping.model_dump_json()})
+        with 
self.update_snapshot(snapshot_properties=snapshot_properties).overwrite() as 
update_snapshot:

Review Comment:
   @syun64 I've rebased on `Fokko:fd-add-ability-to-delete-full-data-files` 
branch and used `delete` function in `add_files_overwrite`. The tests I added 
are passing, but it made it hard to review this PR, probably makes sense to put 
it on pause until fokko's PR is merged. I'll still be pushing more updates to 
tests.   
   
   As for `add_files_overwrite`, at this point, I'm interested only in 
overwriting all, so I'm not adding the `overwrite_filter` argument like the 
`overwrite` method has. But I can add  `overwrite_filter` argument if you think 
it makes sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to