From 700743491167e5c2ead795b529b0ec25f04b20b0 Mon Sep 17 00:00:00 2001 From: prateek11rai <165780365+prateek11rai@users.noreply.github.com> Date: Sun, 29 Nov 2026 14:33:25 +0530 Subject: [PATCH] docs: Document the doc field metadata key for PyArrow schemas Co-Authored-By: Claude Opus 5.5 --- mkdocs/docs/api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index d0d6d08332..7eed8faa51 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -161,7 +161,7 @@ To create a table using a pyarrow schema: import pyarrow as pa schema = pa.schema([ - pa.field("foo", pa.string(), nullable=True), + pa.field("foo", pa.string(), nullable=True, metadata={"doc": "Description of foo"}), pa.field("bar", pa.int32(), nullable=False), pa.field("baz", pa.bool_(), nullable=True), ]) @@ -172,6 +172,8 @@ catalog.create_table( ) ``` +With a PyArrow schema, a column's description is read only from the `doc` key in the field's metadata and stored as the field's `doc` in the Iceberg schema. [`union_by_name`](#union-by-name) reads the same key, and reading a table back into PyArrow sets it on each field that has a description. + Another API to create a table is using the `create_table_transaction`. This follows the same APIs when making updates to a table. This is a friendly API for both setting the partition specification and sort-order, because you don't have to deal with field-IDs. ```python