From a960d43a58cc201183027c38ce679f7bf3a43891 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Date: Thu, 5 Oct 2023 12:06:34 +0530 Subject: [PATCH] Docs: Document publish_changes procedure (#8706) --- docs/spark-procedures.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/spark-procedures.md b/docs/spark-procedures.md index 5303982b2724..d7930fb01e0e 100644 --- a/docs/spark-procedures.md +++ b/docs/spark-procedures.md @@ -192,6 +192,44 @@ Cherry-pick snapshot 1 with named args CALL catalog_name.system.cherrypick_snapshot(snapshot_id => 1, table => 'my_table' ) ``` +### `publish_changes` + +Publish changes from a staged WAP ID into the current table state. + +publish_changes creates a new snapshot from an existing snapshot without altering or removing the original. + +Only append and dynamic overwrite snapshots can be successfully published. + +{{< hint info >}} +This procedure invalidates all cached Spark plans that reference the affected table. +{{< /hint >}} + +#### Usage + +| Argument Name | Required? | Type | Description | +|---------------|-----------|------|-------------| +| `table` | ✔️ | string | Name of the table to update | +| `wap_id` | ✔️ | long | The wap_id to be pusblished from stage to prod | + +#### Output + +| Output Name | Type | Description | +| ------------|------|-------------| +| `source_snapshot_id` | long | The table's current snapshot before publishing the change | +| `current_snapshot_id` | long | The snapshot ID created by applying the change | + +#### Examples + +publish_changes with WAP ID 'wap_id_1' +```sql +CALL catalog_name.system.publish_changes('my_table', 'wap_id_1') +``` + +publish_changes with named args +```sql +CALL catalog_name.system.publish_changes(wap_id => 'wap_id_2', table => 'my_table') +``` + ### `fast_forward` Fast-forward the current snapshot of one branch to the latest snapshot of another.