Writeback

Estimated reading: 9 minutes

7.1 Overview

Write-back enables users to enter data directly into a cube (budgets, forecasts, adjustments, and manual entries) without modifying the underlying source tables. User-entered values are stored separately and automatically merged with source data at query time, with user inputs taking priority.

Data Forms provide a structured, grid-based interface for data entry, similar to Cloud EPM data forms. Forms define a fixed layout (rows, columns, POV) and support features like spreading, locking, cell comments, and composite forms.

Write-back is available through two interfaces:

  • Data Forms: The Streamlit UI for structured, repeatable data entry
  • WRITE_CUBE: A stored procedure for programmatic writes from any SQL-capable tool

7.2 How Write-Back Works

  1. User enters a value: Either through a Data Form or a WRITE_CUBE call, targeting a specific cell (intersection of dimension members).
  2. Value is stored separately: The value is written to a dedicated input table within the application. Your source data is never modified.
  3. Lock check: If any dimension member in the target intersection is locked, the write is rejected (unless explicitly overridden).
  4. Spreading (if applicable): If the target member is a parent (non-bottom-level), the value can be distributed across its bottom-level members using a specified spread method.
  5. Audit logging: Every write is logged with the user, timestamp, target intersection, value, spread method, and previous value.
  6. Merge at query time: When you run a query, the cube automatically merges source data with user-entered values. Where both exist for the same intersection, the user-entered value takes priority.

7.3 WRITE_CUBE (SQL Interface)

The WRITE_CUBE procedure writes a value to a specific cell in the cube.

CALL CASABASE_CUBE.CUBE.WRITE_CUBE(
    'MY_CUBE',                    -- Cube name
    '{                            -- POV JSON (target cell)
        "ACCOUNT": "Revenue",
        "PERIOD": "Jan",
        "ENTITY": "East",
        "SCENARIO": "Budget",
        "VERSION": "Working"
    }',
    250000,                       -- Value to write
    'REPLACE',                    -- Spread method
    NULL,                         -- Spread dimension (optional)
    NULL                          -- Options (optional)
);

Parameters

ParameterRequiredDescription
CUBE_NAMEYesThe cube to write to.
POV_JSONYesJSON object specifying the target cell — one member per dimension.
WRITE_VALUEYesThe numeric value to write.
SPREAD_METHODNoHow to handle the write. Default: REPLACE. See spread methods below.
SPREAD_DIMENSIONNoWhich dimension to spread across. Defaults to the time dimension if one exists.
OPTIONSNoJSON object with additional options (see below).

Spread Methods

MethodDescription
REPLACEWrite the value directly to the target cell. If the target is a bottom-level member, the value is stored as-is.
ADDAdd the value to the existing value at the target cell.
SUBTRACTSubtract the value from the existing value at the target cell.
SPREAD_EVENDistribute the value evenly across all bottom-level members of the target. For example, writing 1200 to Q1 with SPREAD_EVEN sets Jan=400, Feb=400, Mar=400.
SPREAD_PROPORTIONALDistribute the value proportionally based on existing values. If Jan=100, Feb=200, Mar=300, writing 1200 to Q1 sets Jan=200, Feb=400, Mar=600. If no existing values exist, falls back to even distribution.
SPREAD_FILLWrite the same value to every bottom-level member. Writing 500 to Q1 with SPREAD_FILL sets Jan=500, Feb=500, Mar=500.

Options

Pass a JSON object as the OPTIONS parameter to control write behavior:

OptionTypeDefaultDescription
auditBooleantrueWhether to log the write to the audit trail.
dry_runBooleanfalsePreview the write without actually executing it. Returns what would be written.
commentStringnullA comment to attach to the audit log entry.
forceBooleanfalseOverride lock restrictions and write even if the target intersection is locked.
allow_non_leafBooleanfalseAllow writing directly to a parent member without spreading.

Examples

Simple write to a bottom-level cell:

CALL CASABASE_CUBE.CUBE.WRITE_CUBE(
    'FIN_PLAN',
    '{"ACCOUNT": "Revenue", "PERIOD": "Jan", "ENTITY": "East", "SCENARIO": "Budget", "VERSION": "Working"}',
    250000,
    'REPLACE'
);

Spread evenly across a quarter:

CALL CASABASE_CUBE.CUBE.WRITE_CUBE(
    'FIN_PLAN',
    '{"ACCOUNT": "Revenue", "PERIOD": "Q1", "ENTITY": "East", "SCENARIO": "Budget", "VERSION": "Working"}',
    750000,
    'SPREAD_EVEN',
    'PERIOD'
);

Dry run to preview spreading:

CALL CASABASE_CUBE.CUBE.WRITE_CUBE(
    'FIN_PLAN',
    '{"ACCOUNT": "Revenue", "PERIOD": "Q1", "ENTITY": "East", "SCENARIO": "Budget", "VERSION": "Working"}',
    750000,
    'SPREAD_PROPORTIONAL',
    'PERIOD',
    '{"dry_run": true}'
);

Force write to a locked intersection:

CALL CASABASE_CUBE.CUBE.WRITE_CUBE(
    'FIN_PLAN',
    '{"ACCOUNT": "Revenue", "PERIOD": "Jan", "ENTITY": "East", "SCENARIO": "Actual", "VERSION": "Final"}',
    260000,
    'REPLACE',
    NULL,
    '{"force": true, "comment": "Year-end adjustment per CFO approval"}'
);

7.4 Data Forms (Streamlit UI)

Data Forms provide a structured grid interface for data entry. They are designed for repeatable data entry workflows (monthly actuals, budget input, forecast adjustments) where the same layout is used across multiple periods or scenarios.

Using a Data Form

  1. Navigate to Data Forms in the sidebar
  2. Select a cube from the dropdown
  3. Select a form from the form list
  4. Set the POV dimensions (the fixed context — e.g., which scenario, which version)
  5. The grid loads with rows and columns as defined by the form layout
  6. Edit values directly in the grid cells
    • Bottom-level cells are editable (white background)
    • Parent-level cells are read-only (grey background, bold) and display aggregated values
  7. Click Save to commit all pending changes

Data Form Features

FeatureDescription
Grid editingClick any editable cell to change its value. Pending changes are highlighted.
Parent/child displayParent members are shown with indentation and are read-only. Bottom-level members are editable.
Lock awarenessLocked intersections are marked and cannot be edited (unless the form overrides).
Cell commentsAdd comments to specific cells for context or audit purposes. Comments are visible to all users.
SpreadingWhen writing to a parent cell, values can be spread across bottom-level members using the form’s configured spread method.
UndoRevert pending changes before saving.
Pending change trackingAll unsaved changes are tracked and displayed before committing.

7.5 Managing Data Forms (Admin)

Data Forms are created and managed by CUBE_ADMIN users on the Manage Forms tab of the Data Forms page.

Creating a Data Form

  1. Click Create New Form
  2. Configure the form layout:
SettingDescription
Form NameA descriptive name for the form (e.g., Monthly Revenue Input, Budget Entry - East Region).
DescriptionOptional description of the form’s purpose.
Row DimensionsWhich dimensions appear as rows in the grid (e.g., ACCOUNT, ENTITY).
Column DimensionsWhich dimensions appear as columns (e.g., PERIOD).
POV DimensionsWhich dimensions are set as fixed context at the top (e.g., SCENARIO, VERSION).
Default POVPre-set values for POV dimensions so users do not have to select them each time.
Spread MethodDefault spread method for parent-cell writes: REPLACE, SPREAD_EVEN, SPREAD_PROPORTIONAL, or SPREAD_FILL.
Allow SpreadingWhether spreading is enabled for this form.
Allow CommentsWhether cell comments are enabled.
Read OnlyIf true, the form displays data but does not allow editing. Useful for review forms.
Display OrderControls the order in which forms appear in the form list.
Form FolderOptional folder name for organizing forms into groups.
  1. Click Save Form

Composite Forms

Composite forms combine multiple individual forms into a single tabbed view. This is useful when a data entry workflow requires input across multiple related forms (e.g., Revenue, Expenses, and Headcount tabs in a single budget entry experience).

To create a composite form:

  1. Create the individual forms first
  2. Create a new form and mark it as Composite
  3. Select the individual forms to include

Form Management Actions

ActionDescription
EditModify a form’s layout, settings, or defaults.
DuplicateCreate a copy of a form as a starting point for a new one.
DeleteDeactivate a form (soft delete; can be restored).

7.6 Locking

Locks prevent writes to specific dimension members, ensuring that finalized data cannot be accidentally modified.

Managing Locks

Locks are managed from the Admin page in the Streamlit UI or via the cube’s lock configuration.

Lock PropertyDescription
Cube NameWhich cube the lock applies to.
Dimension NameWhich dimension to lock (e.g., VERSION, SCENARIO, PERIOD).
Member NameWhich member to lock (e.g., Final, Actual, Q1).
LockedTRUE to lock, FALSE to unlock.

Lock Behavior

  • When a locked member is part of the target intersection, WRITE_CUBE rejects the write with an error message.
  • The force option in WRITE_CUBE overrides lock restrictions (use with caution).
  • Data Forms respect locks automatically. Locked cells are visually marked and non-editable.
  • Locks are checked at write time, not at form load time. A cell that becomes locked between form load and save will reject the write.

Common Locking Patterns

PatternExample
Close a periodLock PERIOD = Jan after month-end close to prevent further changes.
Finalize a versionLock VERSION = Final when the budget version is approved.
Protect actualsLock SCENARIO = Actual to ensure actual data is only loaded through automated processes.

7.7 Seeding & Input Table Management

Seeding

Seeding pre-populates the input table with values from an existing source, typically used to copy actuals as a starting point for budget or forecast entry.

CALL CASABASE_CUBE.CUBE.SEED_INPUT_TABLE(
    'FIN_PLAN',                           -- Cube name
    'FINANCE_DB.PLANNING.FACT_PLAN',      -- Source data table
    'AMT',                                -- Amount column
    '{                                    -- POV filter
        "SCENARIO": ["Actual"],
        "PERIOD": [{"children": "Year"}]
    }'
);

This copies matching source data into the input table, giving users a pre-populated starting point for data entry.

Undo Last Write

Revert the most recent write operation:

CALL CASABASE_CUBE.CUBE.UNDO_LAST_WRITE('FIN_PLAN');

Creating an Input Table

Input tables are created automatically when you first write to a cube. You can also create one explicitly:

CALL CASABASE_CUBE.CUBE.CREATE_INPUT_TABLE('FIN_PLAN');

7.8 Cell Comments

Cell comments allow users to annotate specific data intersections with notes, explanations, or context.

Adding Comments

  • Data Forms: Click the comment icon on a cell to add, view, or delete comments.
  • Programmatic: Comments can be attached through the WRITE_CUBE options parameter.

Comment Properties

PropertyDescription
Cell intersectionThe specific POV (dimension member combination) the comment is attached to.
Comment textThe annotation content.
Created byThe Snowflake user who added the comment.
Created dateWhen the comment was added.

Comments are visible to all users who can access the form. They are soft-deleted (deactivated) when removed, preserving an audit trail.

7.9 Tips & Best Practices

TipDetails
Use dry_run before large writesPreview what WRITE_CUBE will do before committing, especially with spreading.
Lock before closingLock periods, versions, or scenarios as soon as they are finalized to prevent accidental changes.
Seed from actualsWhen starting a budget cycle, seed the input table from actuals to give users a realistic starting point.
Design forms for the userPlace the most-edited dimensions on rows/columns and set POV defaults for dimensions that rarely change.
Use folders for organizationGroup related forms into folders (e.g., Revenue, Expenses, Headcount) for easier navigation.
Composite forms for workflowsUse composite forms to guide users through multi-step entry processes in a single tabbed view.
Add comments for audit contextEncourage users to add comments explaining adjustments, especially for material changes.
Review pending changes before savingData Forms show all pending changes before committing. Review them to catch errors.
Share this Doc

Writeback

Or copy link

CONTENTS