Skip to content

Writeback in the classic Workbook Editor

15 min read · Updated 26 Nov 2026

This page covers writeback in workbooks built with the classic Workbook Editor. To let viewers of a Data App change data, register a Business Workflow in the semantic layer and follow Let users edit data and save it back; an app hosted outside Astrato writes through the routes in Writeback and SQL.

In a workbook, writeback is done by actions. A viewer enters values in input controls or table cells, and an action writes them to a table in your warehouse with a block from the Writeback & SQL category:

Block What it does
Writeback Insert Adds a row. Each Field row pairs a column with a value.
Writeback Update Changes the rows whose Key columns match the Key values.
Writeback Delete Deletes the rows whose Key columns match the Key values.
Execute SQL Runs the SQL statement stored in a variable. See Call a Supabase Edge Function.

Use Writeback Insert to capture something new, such as a comment or a form submission, and Writeback Update to change a value that already exists, such as a target, a status or a forecast.

The blocks list the tables of the semantic layer the workbook queries. Writeback Update is in the category only where it is turned on for your workspace. Older workbooks can contain the deprecated Writeback block; the editor asks you to replace deprecated blocks with their current versions.

For actions in general, see Actions and Action blocks.

A write runs with the credentials of the semantic layer’s data connection. If that connection uses one shared service user, every viewer writes as that user. If it signs each person in, as Sign in with Snowflake does, each viewer writes as their own database user.

If a write fails, the viewer sees an error notification and the rest of the action stops. To handle the error yourself, put the block inside a Try block: the notification is not shown and the Catch branch runs instead, for example to show your own toast message.

A Writeback Insert writes all its fields as one row, so the row is saved whole or not at all. When it inserts several rows at once, Snowflake, BigQuery, PostgreSQL, Redshift and DuckDB save the whole batch or none of it; ClickHouse and Databricks write each row on its own. An update or delete of several rows is always applied row by row, so some rows can change while others fail.

A write does not reload the workbook’s charts. Add a Refresh data block after it so they query again and show the change.

Write to a table of its own rather than to a table that another system loads. The examples on this page use Snowflake; other warehouses have equivalent statements.

  1. Create a schema for writeback tables, unless it exists already, and the table. This one collects comments:

    USE DATABASE <database>;
    CREATE SCHEMA IF NOT EXISTS WRITE_BACK;
    CREATE TABLE WRITE_BACK.COMMENTS (
    ID INT IDENTITY(1,1),
    COMMENT VARCHAR,
    CREATED_BY VARCHAR(320),
    CREATED_AT TIMESTAMP_LTZ DEFAULT CURRENT_TIMESTAMP()
    );

    Leave ID and CREATED_AT out of the writeback and Snowflake fills them. An identity column gives each row its own number but does not record insertion order; order rows by CREATED_AT.

  2. Grant the role your data connection uses the privileges its actions need. Permissions are managed in the warehouse, not in Astrato:

    GRANT USAGE ON DATABASE <database> TO ROLE <connection_role>;
    GRANT USAGE ON SCHEMA <database>.WRITE_BACK TO ROLE <connection_role>;
    -- SELECT to show the rows, INSERT for Writeback Insert
    GRANT SELECT, INSERT ON TABLE <database>.WRITE_BACK.COMMENTS TO ROLE <connection_role>;
    -- only if your actions also update or delete rows
    GRANT UPDATE, DELETE ON TABLE <database>.WRITE_BACK.COMMENTS TO ROLE <connection_role>;

    See Role and privileges for the rest of the Snowflake set-up. On Supabase or Postgres, grant the connection’s user INSERT, UPDATE or DELETE on the writeback table and USAGE on its sequences, as in Create a read-only user, and add matching policies if the table uses Row Level Security.

  3. Add the table to the semantic layer the workbook queries.

To keep written rows apart from the original data and still analyse them together, give the new table the same structure as the original and combine the two in a view with a flag column:

CREATE TABLE REQUESTS_MANUAL LIKE REQUESTS;
CREATE OR REPLACE VIEW VW_REQUESTS_COMBINED AS
SELECT *, 0 AS MANUAL_INPUT FROM REQUESTS
UNION ALL
SELECT *, 1 AS MANUAL_INPUT FROM REQUESTS_MANUAL;

Write to REQUESTS_MANUAL and build charts on the view.

An input form is a set of input controls, each storing its value in a variable, and a button whose action inserts those values as a new row.

A Benchmarking input form with text fields for contact name, country and company, an order date, a product line dropdown, a quantity slider, a sales amount field, a status dropdown and a Save button

  1. Create a variable for each value, with a type the input can use. See Variables.
  2. From Controls in the left menu, add an input for each value. The inputs are Text input, Text area input, Numeric input, Toggle input, Checkbox input, Dropdown input, Slider input, Range slider input and Date picker.
  3. Select each input and, on its Data tab, choose its variable in Variable. The list offers only variables of a type the input can hold.
  4. Add a Button from Controls. To move the form as one piece, select the inputs and the button and select Group; see Group items.
  5. Open Actions and build an action for the button:
    1. Start with When button emits On click.
    2. Optionally, add an if block so that empty input is not saved.
    3. Add Writeback Insert, choose the table, and add a Field row for each column with the variable that holds its value. To record who wrote the row, set a column to Get Current User Email.
    4. Add Set variable to an empty value for each input you want to clear.
    5. Add Refresh data.
  6. Select Preview and submit the form to test it.

Action blocks: when AddCommentButton emits On click, if the length of Comment is greater than 0, write Comment and the current user’s email to the Comments Write Back table, set Comment to empty, then refresh data

The screenshot shows the deprecated Writeback block; Writeback Insert takes the same Field rows. A field’s value can also be a list, to insert several rows at once. Every list must hold at least one value and all lists must have the same length. A single value in the same block is repeated on every row, so you can set CREATED_BY once for the whole batch.

If a column requires a value, map a value to it, or the insert fails.

A straight table can let viewers edit its cells. The table does not write anything itself: when a viewer confirms an edit, it emits On values change, and your action writes the change with Writeback Update. For the rest of the table’s settings, see Tables.

  1. Include every column the update needs, including the columns that identify a row.

  2. Mark the identifying columns as key columns: open the menu on a column’s field chip and select Mark as key column. The update changes every row whose key columns match, so together the key columns must identify one row.

    The menu of a table column’s field chip, with Change Field, Chart filter, Duplicate, Rename, Delete and Mark as key column, which is outlined

    A key column shows a key icon on its field chip.

    Table field chips for Date, Id2, Source, Score, Comments and Update button, with key icons on Date and Id2

    Do not rename the key columns or the editable columns in the table. The update matches them to the table’s columns by name, and a renamed column makes the write fail with an error that the field or key column does not exist.

  3. Open the settings of each column viewers may change and select Editable. A key column cannot be editable, and Editable is available only for a dimension or measure shown as text (not HTML, Markdown or an image).

    The settings of the Score column, with Show null values and Hide column above the Editable checkbox, which is ticked and outlined

  4. For each editable column, choose an Input type and select Required if the cell must not be left empty. The input types depend on the column’s data type: text columns offer Text and Dropdown, numbers Numeric and Dropdown, dates Date Picker, Dropdown and Numeric, true or false columns Checkbox, and other columns Dropdown only. A Dropdown on a text column can allow several values with Multiselect and a Separator; a Date Picker takes a Min date and a Max date.

  5. Under Writeback settings on the table’s Data tab, choose the Writeback mode:

    Mode What a viewer confirms
    Cell Each edited cell on its own.
    Row (default) All edits in one row together.
    Rows Edits across several rows together. The event passes one list of changes for each changed row.

A viewer confirms edits with the tick and discards them with the cross. In Rows mode the two buttons are at the top of the table.

A checkbox column has two more settings. Instant save, off by default, saves as soon as the viewer selects the box, without the tick. Null display sets how an empty value looks and what selecting it saves:

Null display An empty value shows Selecting it saves
Unchecked (default) an empty box true
Checked a ticked box false
Unset a minus sign true
  1. Open Actions and start with When table emits On values change.

  2. Add Writeback Update, choose the table, and set its inputs from the event’s parameters:

    Input Set it to
    Columns Columns changed
    Values Values changed
    Key columns Key columns
    Key values Key values
    Updated by Optional. A text column that receives the ID of the person who saved.
    Updated at Optional. A timestamp column that receives the time of the update.
  3. Add Refresh data so charts on the same data show the new values.

A key column cannot also be in Columns, and neither Updated by nor Updated at can be in Columns or Key columns. Updated by and Updated at hold the latest change only, not a history. Each viewer’s save runs its own update, so when several people edit the same row, the last save wins.

In Rows mode, Values changed and Key values hold one list for each changed row, and Columns changed one list of columns for each row. Key columns stays a single list, which Writeback Update accepts as it is. Values and Key values must have the same number of rows. When Columns has one list per row, it must have that number of rows too; Columns can instead be a single list, which applies to every row. In each row, the number of columns must match the number of values. Updated by and Updated at are set on every row.

To remove rows, use Writeback Delete with Key columns and Key values in the same way. The connection’s role needs UPDATE for updates and DELETE for deletes.

An edit can also add a row to another table, for example to store a comment on an existing row in a comments table. That keeps a row’s comments apart from the edits to the row itself.

  1. Make a comment column editable in the table, and mark the column that identifies the row as a key column.

  2. Start an action with When table emits On values change.

  3. Add Writeback Insert, choose the comments table, and add a Field row for each column. In Cell or Row mode, take a value from the event with get value at index n in Key values or in Values changed; the first item has index 1. Values changed holds the edited values in the order of Columns changed, so in Row mode, where a viewer can edit several columns at once, take the comment at its position in Columns changed: use get index of comment column name in Columns changed as the index. In Cell mode the only changed value has index 1. To record who wrote it, set a column to Get Current User Email.

    The event also fires when a viewer changes only another column. Put the insert inside an if block that runs only when get index of comment column name in Columns changed is greater than 0; the block returns -1 when the column is not in the list.

  4. Optionally, wrap the insert in Try with toast messages, and end with Refresh data.

The deprecated Writeback block, without the comment-column check described above: when Insert Table emits On values change, inside Try, show a toast, write the ID from the first key value, the comment from the first changed value and the current user’s email, show a success toast, with an error toast in Catch, then refresh data

The screenshot shows the deprecated Writeback block; Writeback Insert takes the same Field rows.

Show writeback controls only to some users

Section titled “Show writeback controls only to some users”

You can show the buttons that write data only to the people who should use them. Showing or hiding a button is a convenience, not access control: actions run in the viewer’s browser, and hiding a button does not stop a write. Decide who can write in the warehouse, by granting write privileges only to the role the data connection uses, and share a writeback workbook only with people who may change its data.

  1. Hide the writeback buttons by default: clear Show object in workbook in each button’s container settings.
  2. In Actions, start with Before workbook opens, or with Enter: sheet to check each time someone opens the sheet.
  3. Add an if block that compares a Current User value, such as Email or Groups, with the people or group allowed to write. Groups returns all the user’s group names in one text, separated by commas. To match a whole group name, and not a longer name that contains it, use split text Groups by , to list and check that get index of group name in that list is greater than 0.
  4. Inside it, show the buttons with Set button container and its visibility. See Change container properties with actions.

To run the same check from several places, put it in a procedure and call the procedure from each trigger.

An action can call a Supabase Edge Function by running a SQL statement in which your Supabase Postgres database sends the HTTP request through the pg_net extension.

Before you start:

  • The workbook queries a semantic layer on your Supabase connection.
  • You have a deployed Edge Function and its URL.
  • Viewers can run Execute SQL only if an administrator turns on Execute SQL action in System settings. Users with other roles can run it without that setting.
  1. In the Supabase SQL editor, enable pg_net once:

    create extension if not exists pg_net;
  2. Give the role your Astrato connection signs in as access to the net schema:

    grant usage on schema net to <astrato_connection_role>;

    Grant this only to the role Astrato uses. Granting it to anon or authenticated lets those roles make your database send HTTP requests too.

    Then check that the role can call net.http_post:

    select p.oid::regprocedure as signature,
    has_function_privilege('<astrato_connection_role>', p.oid, 'execute') as can_execute
    from pg_proc p
    join pg_namespace n on n.oid = p.pronamespace
    where n.nspname = 'net' and p.proname = 'http_post';

    If any row returns false, the call fails with a permission error. Supabase does not support changing the grants on pg_net objects, so connect Astrato with a role that already holds execute. See Supabase’s Revoking access to pg_net objects has no effect.

  3. In the workbook, create a String variable with the SQL query sub-type (see Variable types) and set its value to the call. Replace the placeholders with your function’s URL parts and key:

    select net.http_post(
    url := 'https://<project-ref>.supabase.co/functions/v1/<function-name>',
    headers := jsonb_build_object(
    'Content-Type', 'application/json',
    'Authorization', 'Bearer <function-key>'
    ),
    body := jsonb_build_object('source', 'astrato', 'sent_at', current_timestamp)
    );

    By default, Supabase lets a request reach an Edge Function only with a valid JWT in the Authorization header, and rejects a key of your own. Deploy the function with JWT verification turned off, with supabase functions deploy <function-name> --no-verify-jwt or verify_jwt = false under [functions.<function-name>] in supabase/config.toml. The function is then open to anyone who has its URL, so it must compare the bearer key with a secret it holds and reject any request that does not match.

  4. In an action, add Execute SQL and choose the variable in Select SQL variable.

net.http_post queues the request and pg_net sends it after the transaction that queued it commits; if that transaction rolls back, the request is not sent. A successful action therefore means the request was queued, not that the function succeeded. Check the function’s logs in Supabase.

Anyone who can edit the workbook can read the variable, so never put the Supabase service role key in it. Use a key that is specific to the function, which the function checks, or call a database function that reads the secret from Supabase Vault. Either way, pg_net keeps each request’s headers in net.http_request_queue until it is sent, where any role that can log in to the database can read them by default. Give login only to the roles you trust to send HTTP requests, and keep net out of the schemas exposed through the Supabase Data API.

Writeback works in workbooks you embed for signed-in users. Through an external embed link, writeback blocks run only while Writeback on external embed links is on, and Execute SQL only while Execute SQL action on external embed links is on. Both are in System settings and need External embed links.

Astrato tags its Snowflake queries, so you can find each insert, update and delete in the query history, with the warehouse user who ran it. See Query telemetry.

Problem What to check
The table is missing from the block’s list Add the table to the semantic layer the workbook queries.
The write fails with a permission error Grant the connection’s role INSERT, UPDATE or DELETE on the table, as the block needs.
An insert fails because a column requires a value Map a value to every required column in Writeback Insert.
An update changes more rows than expected The key columns do not identify one row. Add key columns until they do.
Charts still show the old values Add Refresh data after the writeback block.
Writeback or Execute SQL does nothing in an external embed Turn on the matching setting under Writeback in embedded workbooks.