Fokko commented on code in PR #6323:
URL: https://github.com/apache/iceberg/pull/6323#discussion_r1216693809
##########
python/pyiceberg/table/__init__.py:
##########
@@ -69,21 +72,288 @@
import ray
from duckdb import DuckDBPyConnection
+ from pyiceberg.catalog import Catalog
ALWAYS_TRUE = AlwaysTrue()
+class TableUpdates:
Review Comment:
Good one. First of all, if we as a community decide that we really want to
make things strict (which is a good thing), we should do checks on the server
side that forbid this kind of operation. We can also add this on the Python
side, for example, set the IDs of the existing fields (using the
WithPartnerVisitor). People always will find ways to do weird stuff :D (for
example, by copying Python snippets).
I would expect something like this:
```python
catalog = load_catalog(...)
schema = Schema(
NestedField(field_id=0, name='id', field_type=LongType()),
schema_id=1
)
table = catalog.create_table(identifier='test', schema=schema)
new_schema = table.schema.alter.add_field(
name="data",
type=StringType(),
required=False
)
new_schema = table.schema.alter.drop_field(
name="id"
)
table.set_schema(
new_schema
)
```
However, this gets awkward for lists, maps, and structs.
--
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]