-
Notifications
You must be signed in to change notification settings - Fork 332
Closed
Milestone
Description
Apache Iceberg version
main (development)
Please describe the bug 🐞
I can't write a UUID in an iceberg table
from pyiceberg.catalog.rest import RestCatalog
from pyiceberg.schema import Schema
from pyiceberg.types import NestedField, UUIDType
import polars as pl
import uuid
catalog = RestCatalog(
"default",
**{
"uri": "http://localhost:8181",
"warehouse": "s3://test-bucket/",
"s3.endpoint": "http://localhost:9020",
},
)
catalog.create_namespace("default")
id_to_write = uuid.uuid4()
iceberg_schema = Schema(
NestedField(1, "id", UUIDType(), required=True),
)
catalog.create_table(
"default.aaa",
schema=iceberg_schema,
)
df = pl.DataFrame({}).with_columns([pl.lit(id_to_write.bytes).alias("id")])
df = df.to_arrow()
df = df.cast(target_schema=iceberg_schema.as_arrow())
table = catalog.load_table("default.aaa")
table.append(df)
but if I comment the call to _check_schema_compatible
then it write to the table
iceberg-python/pyiceberg/table/__init__.py
Line 485 in a6cd0cf
_check_schema_compatible(self._table.schema(), other_schema=df.schema) |
and I can read the data with trino
tlegrave and Fokko
Metadata
Metadata
Assignees
Labels
No labels