syun64 commented on issue #278:
URL: https://github.com/apache/iceberg-python/issues/278#issuecomment-1906647358
That makes sense @Fokko .
Just to make sure we are on the same page, does the following approach align
with your thoughts?
We are proposing to update the create_table API to:
```
def create_table(
self,
identifier: Union[str, Identifier],
schema: Union[Schema, pa.sSchema],
location: Optional[str] = None,
partition_spec: PartitionSpec = UNPARTITIONED_PARTITION_SPEC,
sort_order: SortOrder = UNSORTED_SORT_ORDER,
properties: Properties = EMPTY_DICT,
) -> Table:
...
if isinstance(schema, pa.Schema):
schema = pre_order_visit_pyarrow(schema,
_ConvertToIcebergWithFreshIds())
...
# existing code
```
We will call the function like:
```
table: pa.Table
catalog = load_catalog()
catalog.create_table('some.table', schema=table.schema)
```
And use the previously proposed Visitor:
https://github.com/syun64/iceberg-python/blob/preorder-fresh-schema/pyiceberg/io/pyarrow.py#L994
since
[new_table_metadata](https://github.com/apache/iceberg-python/blob/46b25be424d1ef0f28778b0873c4d91bf117a2a7/pyiceberg/table/metadata.py#L399)
has to take `field_id`ed Iceberg Schema as the input?
--
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]