From c377bffd09bc383e79a7e39414edb3116e38440a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeppe=20Finne=20S=C3=B8rensen?= Date: Mon, 16 Dec 2024 11:24:02 +0100 Subject: [PATCH 1/8] Change dot notation in add column documentation to tuple --- mkdocs/docs/api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index eaffb84a54..ee2f48b414 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -950,8 +950,8 @@ Using `add_column` you can add a column, without having to worry about the field ```python with table.update_schema() as update: update.add_column("retries", IntegerType(), "Number of retries to place the bid") - # In a struct - update.add_column("details.confirmed_by", StringType(), "Name of the exchange") + # In a struct - a struct must exist before columns can added to it + update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") ``` ### Rename column From 95f44bc220b0885edefad5c2e7bcecf6a39fd511 Mon Sep 17 00:00:00 2001 From: jeppe-dos Date: Mon, 6 Jan 2025 11:58:16 +0100 Subject: [PATCH 2/8] Update move and rename column struct in api.md --- mkdocs/docs/api.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index ee2f48b414..9ef66085cb 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -950,9 +950,11 @@ Using `add_column` you can add a column, without having to worry about the field ```python with table.update_schema() as update: update.add_column("retries", IntegerType(), "Number of retries to place the bid") - # In a struct - a struct must exist before columns can added to it + # In a struct + update.add_column("details", StructType()) update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") ``` +A complex type must exist before columns can added to it. Fields in complex types are added in a tuple. ### Rename column @@ -961,20 +963,21 @@ Renaming a field in an Iceberg table is simple: ```python with table.update_schema() as update: update.rename_column("retries", "num_retries") - # This will rename `confirmed_by` to `exchange` - update.rename_column("properties.confirmed_by", "exchange") + # This will rename `confirmed_by` to `exchange` in the `details` struct + update.rename_column("details", "confirmed_by"), "exchange") ``` ### Move column -Move a field inside of struct: +Move order of fields: ```python with table.update_schema() as update: update.move_first("symbol") + # This will move `bid` after `ask` update.move_after("bid", "ask") - # This will move `confirmed_by` before `exchange` - update.move_before("details.created_by", "details.exchange") + # This will move `confirmed_by` before `exchange` in the `details` struct + update.move_before("details", "confirmed_by"), ("details", "exchange")) ``` ### Update column @@ -1006,6 +1009,8 @@ Delete a field, careful this is a incompatible change (readers/writers might exp ```python with table.update_schema(allow_incompatible_changes=True) as update: update.delete_column("some_field") + # In a struct + update.delete_column("details", "confirmed_by")) ``` ## Partition evolution From 841d4dcdc44382252d6f0b269a5a29b3b0772664 Mon Sep 17 00:00:00 2001 From: jeppe-dos Date: Mon, 6 Jan 2025 16:23:47 +0100 Subject: [PATCH 3/8] Correct rename_column, move_before and delete_column in api.md --- mkdocs/docs/api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index 9ef66085cb..5543307a23 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -964,7 +964,7 @@ Renaming a field in an Iceberg table is simple: with table.update_schema() as update: update.rename_column("retries", "num_retries") # This will rename `confirmed_by` to `exchange` in the `details` struct - update.rename_column("details", "confirmed_by"), "exchange") + update.rename_column(("details", "confirmed_by"), ("detail", "exchange")) ``` ### Move column @@ -977,7 +977,7 @@ with table.update_schema() as update: # This will move `bid` after `ask` update.move_after("bid", "ask") # This will move `confirmed_by` before `exchange` in the `details` struct - update.move_before("details", "confirmed_by"), ("details", "exchange")) + update.move_before(("details", "confirmed_by"), ("details", "exchange")) ``` ### Update column @@ -1010,7 +1010,7 @@ Delete a field, careful this is a incompatible change (readers/writers might exp with table.update_schema(allow_incompatible_changes=True) as update: update.delete_column("some_field") # In a struct - update.delete_column("details", "confirmed_by")) + update.delete_column(("details", "confirmed_by")) ``` ## Partition evolution From ac6ba09368eb78e149f1f6f3316f961ec47dde86 Mon Sep 17 00:00:00 2001 From: jeppe-dos Date: Mon, 6 Jan 2025 18:18:16 +0100 Subject: [PATCH 4/8] Change exchange to processed by on rename_column in api.md --- mkdocs/docs/api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index 5543307a23..57cb64a36e 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -963,8 +963,8 @@ Renaming a field in an Iceberg table is simple: ```python with table.update_schema() as update: update.rename_column("retries", "num_retries") - # This will rename `confirmed_by` to `exchange` in the `details` struct - update.rename_column(("details", "confirmed_by"), ("detail", "exchange")) + # This will rename `confirmed_by` to `processed_by` in the `details` struct + update.rename_column(("details", "confirmed_by"), ("detail", "processed_by")) ``` ### Move column From 51f9c152cc9234e2d807ca037af7025c4ec0f0ef Mon Sep 17 00:00:00 2001 From: jeppe-dos Date: Tue, 7 Jan 2025 09:55:55 +0100 Subject: [PATCH 5/8] Update mkdocs/docs/api.md Co-authored-by: Kevin Liu --- mkdocs/docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index 57cb64a36e..6492339545 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -954,7 +954,7 @@ with table.update_schema() as update: update.add_column("details", StructType()) update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") ``` -A complex type must exist before columns can added to it. Fields in complex types are added in a tuple. +A complex type must exist before columns can be added to it. Fields in complex types are added in a tuple. ### Rename column From 2fef448297380a259b87c43f5076f1e0a24bbe99 Mon Sep 17 00:00:00 2001 From: jeppe-dos Date: Wed, 8 Jan 2025 10:18:54 +0100 Subject: [PATCH 6/8] Fix rename column in api.md --- mkdocs/docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index 6492339545..5afc7cfed1 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -964,7 +964,7 @@ Renaming a field in an Iceberg table is simple: with table.update_schema() as update: update.rename_column("retries", "num_retries") # This will rename `confirmed_by` to `processed_by` in the `details` struct - update.rename_column(("details", "confirmed_by"), ("detail", "processed_by")) + update.rename_column(("details", "confirmed_by"), "processed_by") ``` ### Move column From fe1af10abe1c3fe3506e4d989d13d56eb63d74b1 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Thu, 9 Jan 2025 13:11:43 -0500 Subject: [PATCH 7/8] Update mkdocs/docs/api.md --- 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 5afc7cfed1..67b53adfbc 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -952,7 +952,9 @@ with table.update_schema() as update: update.add_column("retries", IntegerType(), "Number of retries to place the bid") # In a struct update.add_column("details", StructType()) - update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") + + with table.update_schema() as update: + update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") ``` A complex type must exist before columns can be added to it. Fields in complex types are added in a tuple. From d536cd8275e7ebd75a952df2b9241d2e55f438b1 Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Thu, 9 Jan 2025 13:12:11 -0500 Subject: [PATCH 8/8] Update mkdocs/docs/api.md --- mkdocs/docs/api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs/docs/api.md b/mkdocs/docs/api.md index 67b53adfbc..f193bd7c21 100644 --- a/mkdocs/docs/api.md +++ b/mkdocs/docs/api.md @@ -953,8 +953,8 @@ with table.update_schema() as update: # In a struct update.add_column("details", StructType()) - with table.update_schema() as update: - update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") +with table.update_schema() as update: + update.add_column(("details", "confirmed_by"), StringType(), "Name of the exchange") ``` A complex type must exist before columns can be added to it. Fields in complex types are added in a tuple.