amogh-jahagirdar commented on code in PR #245: URL: https://github.com/apache/iceberg-python/pull/245#discussion_r1468130973
########## pyiceberg/table/__init__.py: ########## @@ -2271,3 +2325,240 @@ def commit(self) -> Snapshot: ) return snapshot + + +class UpdateSpec: + _table: Table + _name_to_field: Dict[str, PartitionField] = {} + _name_to_added_field: Dict[str, PartitionField] = {} + _transform_to_field: Dict[Tuple[int, str], PartitionField] = {} + _transform_to_added_field: Dict[Tuple[int, str], PartitionField] = {} + _renames: Dict[str, str] = {} + _added_time_fields: Dict[int, PartitionField] = {} + _case_sensitive: bool + _adds: List[PartitionField] + _deletes: Set[int] + _last_assigned_partition_id: int + _transaction: Optional[Transaction] + _unassigned_field_name = 'unassigned_field_name' Review Comment: Need to find a better solution, the reason for this is that PartitionField has a validation in the model that the name is defined at the time of construction, but the API does not have the field name as required and we use the name visitor to provide the name in the default case and the visitor works on a field itself which needs to be constructed already. 2 ways forward: 1.) Remove the validation (-1 this because it should have a name at the time of construction IMO to avoid users breaking the spec unintentionally) 2.) For the first iteration we could just make the API have a required partition field name. I'm leaning towards 2 since that's simpler and I don't think Python users would have too much issue specifying an explicit partition field name and we can add the default name logic later on? @Fokko @HonahX what do you think? -- 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