You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2026/01/28 11:02:12 UTC
(paimon) branch master updated: [python/doc] add alterTable in pypaimon doc (#7140)
This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 7fddbe4467 [python/doc] add alterTable in pypaimon doc (#7140)
7fddbe4467 is described below
commit 7fddbe4467e646ccf4f41d1a5c9b0910da25b652
Author: XiaoHongbo <13...@qq.com>
AuthorDate: Wed Jan 28 19:02:06 2026 +0800
[python/doc] add alterTable in pypaimon doc (#7140)
---
docs/content/pypaimon/python-api.md | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/docs/content/pypaimon/python-api.md b/docs/content/pypaimon/python-api.md
index 04c7248126..5516adf7fb 100644
--- a/docs/content/pypaimon/python-api.md
+++ b/docs/content/pypaimon/python-api.md
@@ -153,6 +153,34 @@ catalog.create_table(
table = catalog.get_table('database_name.table_name')
```
+## Alter Table
+
+Alter a table with a list of schema changes. Use `SchemaChange` from `pypaimon.schema.schema_change` and types from `pypaimon.schema.data_types` (e.g. `AtomicType`).
+
+```python
+from pypaimon.schema.schema_change import SchemaChange
+from pypaimon.schema.data_types import AtomicType
+
+# Add column(s)
+catalog.alter_table(
+ 'database_name.table_name',
+ [
+ SchemaChange.add_column('new_col', AtomicType('STRING')),
+ SchemaChange.add_column('score', AtomicType('DOUBLE'), comment='optional'),
+ ],
+ ignore_if_not_exists=False
+)
+
+# Drop column
+catalog.alter_table(
+ 'database_name.table_name',
+ [SchemaChange.drop_column('col_name')],
+ ignore_if_not_exists=False
+)
+```
+
+Other supported changes: `SchemaChange.rename_column`, `update_column_type`, `update_column_comment`, `set_option`, `remove_option`, `update_comment`.
+
## Batch Write
Paimon table write is Two-Phase Commit, you can write many times, but once committed, no more data can be written.