HonahX commented on code in PR #506: URL: https://github.com/apache/iceberg-python/pull/506#discussion_r1525843647
########## pyiceberg/table/__init__.py: ########## @@ -1147,6 +1149,27 @@ def overwrite(self, df: pa.Table, overwrite_filter: BooleanExpression = ALWAYS_T for data_file in data_files: update_snapshot.append_data_file(data_file) + def add_files(self, file_paths: List[str]) -> None: + """ + Shorthand API for adding files as data files to the table. + + Args: + file_paths: The list of full file paths to be added as data files to the table + + Raises: + FileNotFoundError: If the file does not exist. + """ + if len(self.spec().fields) > 0: + raise ValueError("Cannot write to partitioned tables") Review Comment: ```suggestion raise ValueError("Cannot add files to partitioned tables") ``` ########## mkdocs/docs/api.md: ########## @@ -292,6 +292,39 @@ The nested lists indicate the different Arrow buffers, where the first write res <!-- prettier-ignore-end --> +### Add Files + +Expert Iceberg users may choose to commit existing parquet files to the Iceberg table as data files, without rewriting them. Review Comment: Shall we mention in the doc that this procedure currently only work for unpartitioned table? -- 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