p1c2u commented on issue #1797:
URL: 
https://github.com/apache/iceberg-python/issues/1797#issuecomment-2728701377

   I had similar problem when trying to create table with pyarrow schema. You 
need to covert the schema into iceberg schema and assign field ids first:
   
   ```python
   schema_without_ids = _pyarrow_to_schema_without_ids(batches.get_schema())
   schema_with_ids = assign_fresh_schema_ids(schema_without_ids)
   ```
   
   Then you can grab ids to use inside partition spec
   
   ```python
   event_time_field_id = schema_with_ids.find_field("event_time").field_id
   partition_spec = PartitionSpec(PartitionField(
           source_id = event_time_field_id,
           field_id = 1000,
           name="event_date",
           transform=DayTransform(),
       ))
   ```


-- 
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