> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish a table result

> Turn the inline orders summary into a durable Iceberg table. Verify the commit, query the output, and repeat the run without adding duplicate summary rows.

How-to guideApplies to: Unified engine deployments

Turn the inline orders summary into a durable Iceberg table. Verify the commit, query the output, and repeat the run without adding duplicate summary rows.

## Before you start

You need a writable Iceberg catalog with namespace and table creation. Use an unused namespace; this lesson uses `learn_workloads_01`. Replace it everywhere if it already exists.

In Workbench, select your writable catalog. Run the setup as one script:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE NAMESPACE learn_workloads_01;
CREATE TABLE learn_workloads_01.category_sales (
  category STRING,
  sales BIGINT
) USING iceberg;
```

Expect an empty table. Record the catalog name. Do not assume that a catalog named `default` exists or supports writes.

## 1. Open the publication workflow

Replace the workload's catalog with your writable catalog. Keep namespace `learn_workloads_01` and apply it to every task. The `publish` task waits for `summarize` and reads its `category_totals` result.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "name": "Learn - publish category sales",
  "tasks": [
    {
      "name": "summarize",
      "sql": "WITH orders(id, category, region, amount) AS (\n  VALUES\n    (1, 'Books', 'North', 20),\n    (2, 'Games', 'South', 30),\n    (3, 'Games', 'North', 15),\n    (4, 'Books', 'North', 40),\n    (5, 'Garden', 'South', 25),\n    (6, 'Garden', 'North', 10)\n)\nSELECT category, SUM(amount) AS sales\nFROM orders\nGROUP BY category;",
      "settings": {
        "current_catalog": "default",
        "namespace": [
          "learn_workloads_01"
        ],
        "time_zone": "UTC",
        "case_sensitive": false,
        "ansi_enabled": true
      }
    },
    {
      "name": "publish",
      "sql": "INSERT OVERWRITE TABLE learn_workloads_01.category_sales\nSELECT category, sales FROM category_totals;",
      "settings": {
        "current_catalog": "default",
        "namespace": [
          "learn_workloads_01"
        ],
        "time_zone": "UTC",
        "case_sensitive": false,
        "ansi_enabled": true
      }
    }
  ],
  "dependencies": [
    {
      "upstream": "summarize",
      "downstream": "publish",
      "input_name": "category_totals"
    }
  ],
  "options": {
    "execution_target": "DuckDb"
  },
  "policy": "Manual"
}
```

## 2. Run and inspect the commit

Validate, save with a Manual schedule, and start a run. Confirm both tasks succeed. Open the publication task and inspect its commit details. A successful summary query alone does not prove that the table write committed.

## 3. Verify the table

In Workbench, use the same catalog and run:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT category, sales
FROM learn_workloads_01.category_sales
ORDER BY category;
```

| category | sales |
| - | -: |
| Books | 60 |
| Games | 45 |
| Garden | 35 |

Start the workload again. Expect the same three rows. `INSERT OVERWRITE` replaces the table contents; `INSERT INTO` would append another set of rows.

## Choose repeat behavior deliberately

Overwrite suits this complete summary because each run produces the full desired table. A windowed publication needs a write strategy that preserves other windows, such as a supported keyed MERGE. Replacing the whole table with one day's output would lose other days.

A workload is not one transaction across all tasks. If an earlier task commits and a later task fails, the earlier write can remain visible. Selective reruns do not undo it or freeze the latest contents of an external table.

## Clean up

Keep the schedule Manual, or pause it if you enabled recurring execution. Wait for active runs to finish and remove the lesson workload when no longer needed. Drop only the objects created for this lesson:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
DROP TABLE learn_workloads_01.category_sales;
DROP NAMESPACE learn_workloads_01;
```

Use the same catalog. See [Results and table commits](https://docs.e6data.com/transformation/workloads/results-and-commits.md) before repeating an uncertain write.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.