Skip to content

Write-back 101: add comments to a workbook

4 min read · Updated 17 Nov 2026

Writeback lets people enter data in a workbook and save it to a table in your warehouse. This page builds the simplest case: a comment box. Viewers type a comment, select Add comment, and the comment is inserted into a Snowflake table together with the email address of the person who wrote it. The table then shows the new comment.

Before you start: you need to be able to create tables and grant privileges in Snowflake, and to add a table to a workbook’s data model.

Create a table to receive the comments. This example creates it in the WRITE_BACK_101 schema, which the grants in Step 2 use. Run the statements in this step in the database that holds, or will hold, that schema. If the schema does not exist, create it first. This needs the CREATE SCHEMA privilege on the database:

CREATE SCHEMA IF NOT EXISTS WRITE_BACK_101;

To use another schema, replace WRITE_BACK_101 in this step and in Step 2. Then create the table:

CREATE TABLE WRITE_BACK_101.COMMENTS_WRITE_BACK (
ID INT IDENTITY(1,1),
COMMENT VARCHAR,
CREATED_BY VARCHAR(320),
CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
);

If a table with that name already exists, the statement fails rather than replacing it. Choose another name, and use it in the steps that follow.

Column Purpose
ID Optional here, but useful if you later update or delete comments. IDENTITY(1,1) starts at 1 and adds 1 for each row. Leave it out of the writeback so Snowflake fills it.
COMMENT The text of the comment.
CREATED_BY The email address of the person who wrote the comment.
CREATED_AT Defaults to the time the row is inserted. Leave it out of the writeback so Snowflake fills it.

It is an ordinary table: writeback needs no special schema or object type.

Writes reach Snowflake through the workbook’s data connection, so the Snowflake role that connection uses needs INSERT on the table. Permissions are managed in Snowflake, not in Astrato. In the examples below, WRITE_BACK_101 is the schema and ANALYST stands for your connection’s role.

To grant INSERT on every existing table in the schema:

GRANT INSERT ON ALL TABLES IN SCHEMA WRITE_BACK_101 TO ROLE ANALYST;

To grant it on the comments table only:

GRANT INSERT ON TABLE WRITE_BACK_101.COMMENTS_WRITE_BACK TO ROLE ANALYST;

The role also needs USAGE on the database and schema, and SELECT on the table to show the comments. See Snowflake’s GRANT privileges reference for the full list.

Add COMMENTS_WRITE_BACK to the workbook’s data model, then add:

  • a table that shows the comments
  • a text area for typing a new comment
  • a button labelled Add comment

A variable holds the comment until it is written back. Create a text variable named Comment:

Variables panel in the workbook editor with a string variable named Comment and an Add Variable button.

Link the variable to the text area, so that whatever is typed is stored in Comment. The workbook now looks like this:

Write-back 101 workbook in the editor showing a Comment text area, an Add comment button and a Workbook comments table.

Actions connect the button, the variable and the table. Open them in either of two ways:

  • Select Actions at the bottom of the editor’s left toolbar.

    The Actions button, an icon with the label Actions, from the editor’s left toolbar.

  • Select Actions at the bottom of the Data tab in a control’s property panel.

    Data tab of an input’s property panel with the Comment variable selected and an Actions button at the bottom.

Actions opens full screen, with the block categories on the left and an empty canvas:

Full-screen Actions panel with Triggers, Logic and Outcomes categories on the left, block palette beside them and an empty canvas.

Start with a When block for the Add comment button’s On click event, then add:

  1. An if block that checks that the length of Comment is greater than 0, so empty comments are not saved.
  2. Inside it, a writeback block that inserts Comment into the COMMENT column and the current user’s email into CREATED_BY of Comments Write Back. The email comes from the Current User context values.
  3. A block that sets Comment back to empty, which clears the text area.
  4. A Refresh data block, so the table shows the new comment.

Action blocks: when AddCommentButton emits On click, if length of Comment > 0, write Comment and Created By (Current User Email) to Comments Write Back, set Comment empty, refresh data.

The writeback blocks are in the Writeback & SQL category.

Select Preview, type a comment and select Add comment. The comment appears in the table: