Create reference tables using the UI

You can upload a CSV file in the UI to create a reference table. The input CSV file must be well-formed, which means the following:

  • Every row must have the same number of columns
  • The type of each row must be consistent with the schema, if specified
  • Header is optional
  • The column names in the header must be a valid dataset column name
  • File size can be up to 10 MiB

Create a reference table

Perform the following steps to upload a CSV file and create a reference table.

  1. Log into your Observe by Snowflake instance, and click Data & integrations > Add data from the left menu.
  2. Click CSV file.
  3. Give a name to your reference table.
  4. Upload your CSV file.
  5. Select a primary key.
  6. Optionally, change the type of columns, such as String, Integer, Float, or Boolean.
  7. Click Save reference table.

You can also create a reference table from the Dataset page. See Create a reference table from the Dataset page.

Update a reference table

Perform the following steps to edit a reference table:

  1. In the left navigation, click Datasets to access the Datasets Explorer.
  2. Find the reference table you want to edit.
  3. Hover on the row of the reference table you want to edit and click the table cells icon () to open the Dataset page.
  4. Click the Definition tab.

You can update this reference table by uploading a new CSV, or by making edits to individual cells.

Update methodUse case
Upload a new CSV file to replace and overwrite the existing reference table.You may want to do this if your table requires more extensive updates, such as adding new columns, or you are the only person able to make changes to this reference table.

Replacing the CSV file replaces every row, including rows that were edited in place. If someone saves row edits while you are replacing the file, their edits can be lost.

To edit rows, see Edit rows in a reference table.
Edit the table directly:
  • Make changes in individual cells.
  • Add new rows to the table
  • Delete rows from the table.
This allows different teams or individuals to make concurrent edits to different rows in the table. All of the changes persist, and every change is atomic and audited.

Click Save reference table when you are done with your updates.

Edit rows in a reference table

You can add, edit, and delete individual rows of a reference table directly in Observe by Snowflake, without downloading, editing, and re-uploading the CSV file. Changes are saved together as one update, and edits made by different people to different rows never overwrite each other.

Before you begin

Make sure the following requirements are met before you edit rows in a reference table:

  • The reference table must have a primary key: one or more columns whose values identify each row uniquely. If the table has no primary key, see Set a primary key.
  • You need edit permission on the reference table to save changes. Without it, Save reference table is disabled.

Edit rows

Perform the following steps to edit rows in a reference table:

  1. In the left navigation, click Datasets to access the Datasets Explorer.
  2. Find the reference table you want to edit.
  3. Hover on the row of the reference table you want to edit and click the table cells icon () to open the Dataset page.
  4. Click the Definition tab. The Edit table section shows the table's rows.
  5. Make your changes:
    • Edit a value: click a cell and type the new value. To clear a value, delete the cell's
      contents; it is saved as empty (null). Edited rows are highlighted.
    • Add a row: click Add row. A blank row appears at the top of the table. Fill in at
      least the primary key columns; a new row is not saved until all of its primary key columns
      have a value.
    • Delete a row: click the delete icon at the end of the row. To undo, click Restore.
    • Find rows: use the filter above the table to narrow down the rows shown.
  6. To review your changes before saving, click N pending changes. The list shows each
    change, the primary key of the affected row, and what changed.
  7. Click Save reference table to save your changes.

After saving, Observe by Snowflake shows how many rows were added, updated or deleted, and reloads the table. If the save fails, nothing is changed, the error is shown, and your changes stay pending so you can fix them and save again.

Change a primary key value

You can edit the value of a primary key column like any other cell. Observe by Snowflake saves this as deleting the row with the old key and adding a row with the new key. If another row already uses the new key, the save fails and nothing is changed, so you never overwrite an existing row by accident. Change the key to an unused value, or delete the existing row first, then save again.

How row edits interact with other changes

When you edit a reference table row, be aware of how this change affects other changes to the table:

Type of change to the tableDescription
Edits by other usersOnly the rows you changed are sent when you save. If someone else edits a different row at the same time, both changes are kept. If two people edit the same row, the last save wins for the columns each of them changed.
Replace the CSV fileUploading a new version of the CSV file replaces all rows, including rows edited in place.
Downstream components using the reference tableDatasets, Worksheets, dashboards, and Monitors that use the reference table are notified the same way as when you replace the CSV file. Editing rows does not rematerialize the reference table.
Reference tables managed by TerraformBy default, the next terraform apply on a reference table managed with the Observe by Snowflake Terraform provider (observe_reference_table) uploads the CSV file from your configuration again and replaces the edited rows.

To keep row edits, set allow_row_edits = true on the resource. Terraform then uploads the file only when you change the file or the table's schema, primary key, or label field. That upload replaces all rows, including rows edited in Observe by Snowflake, and terraform plan doesn't show row edits as changes.

Set allow_row_edits before anyone edits the rows: if the table already has row edits when you set it, or when you import the table into Terraform, the next terraform apply uploads the file once and replaces them.

Set a primary key

Row editing requires a primary key. If the reference table doesn't have one, the Edit table
section shows the rows as read-only with the following message:

No primary key selected - at least one is required to edit the table.

Perform the following steps to set a primary key:

  1. Click Select primary key.
  2. Select one or more columns that together identify each row uniquely.
  3. Click Select primary key again to save the key. Row editing is enabled right away.

Observe by Snowflake checks that the selected columns are unique across all current rows. If they aren't, the following message appears along with the key values that appear more than once:

This primary key isn't unique in the current table content

Pick different columns, or remove the duplicate rows (for example by replacing the CSV file) and try again.

Only users with edit permission on the reference table can set the primary key.

View the edit history

Click the Edit history tab on a reference table to see every saved row edit, newest first.
Each entry shows:

  • Time: when the edit was saved.
  • User: who saved it.
  • Changes: how many rows were added or updated, and how many were deleted.
  • Keys: the primary key of each changed row and whether it was upserted or deleted.

The history records which rows changed, not their values before and after the change. It does
not include saves that failed or CSV file replacements. Row edits are also recorded in the audit
log as updates to the reference table.

Limits

  • One save can include up to 200 changed rows. For larger changes, replace the CSV file.
  • Values must match the column type: for example, an int64 column accepts whole numbers only.

Delete a reference table

Perform the following steps to delete a reference table.

  1. In the left navigation, click Datasets to access the Datasets Explorer.
  2. Find the reference table you want to delete.
  3. Hover on the row of the reference table you want to delete and click the table cells icon () to open the Dataset page.
  4. Click the vertical ellipsis icon () and select Delete.




Did this page help you?