rdblue commented on code in PR #6323: URL: https://github.com/apache/iceberg/pull/6323#discussion_r1209497316
########## python/mkdocs/docs/api.md: ########## @@ -241,52 +146,88 @@ catalog.create_table( ) ``` -Which returns a newly created table: +## Altering the table metadata + +Using the Python API you can alter table metadata. + +### Update the schema + +Add a new field to the table: + +```python +from pyiceberg.schema import Schema +from pyiceberg.types import ( + BooleanType, + DoubleType, + IntegerType, + NestedField, + StringType, + TimestampType, +) + +schema = Schema( + NestedField(field_id=1, name="str", field_type=StringType(), required=False), + NestedField(field_id=2, name="int", field_type=IntegerType(), required=True), + NestedField(field_id=3, name="bool", field_type=BooleanType(), required=False), + NestedField( + field_id=4, name="datetime", field_type=TimestampType(), required=False + ), + # Add a new column to the table + NestedField(field_id=5, name="double", field_type=DoubleType(), required=False), +) + +table = table.alter().set_schema(schema).commit() Review Comment: We should also remove it from docs until we know what API we will provide. -- 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]
