rdblue commented on code in PR #41:
URL: https://github.com/apache/iceberg-python/pull/41#discussion_r1456469457
##########
pyiceberg/table/__init__.py:
##########
@@ -856,6 +909,61 @@ def history(self) -> List[SnapshotLogEntry]:
def update_schema(self, allow_incompatible_changes: bool = False,
case_sensitive: bool = True) -> UpdateSchema:
return UpdateSchema(self,
allow_incompatible_changes=allow_incompatible_changes,
case_sensitive=case_sensitive)
+ def append(self, df: pa.Table) -> None:
+ """
+ Append data to the table.
+
+ Args:
+ df: The Arrow dataframe that will be appended to overwrite the
table
+ """
+ if len(self.spec().fields) > 0:
+ raise ValueError("Cannot write to partitioned tables")
+
+ if len(self.sort_order().fields) > 0:
+ raise ValueError("Cannot write to tables with a sort-order")
+
+ snapshot_id = self.new_snapshot_id()
+
+ data_files = _dataframe_to_data_files(self, df=df)
+ merge = _MergeAppend(operation=Operation.APPEND, table=self,
snapshot_id=snapshot_id)
Review Comment:
Is this really a "merge append" if the operation may be overwrite? You might
consider using `_MergingCommit` or `_MergingSnapshotProducer` (if you want to
follow the Java convention).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]