> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://docs.mammoth.io/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Parameters and snippets

> Define reusable values (Parameters) and code blocks (Snippets) once and reference them across Mammoth pipelines. Covers creating, editing, and scope.

Parameters and Snippets let you define reusable values and code once and reference them across all your pipelines. When you change a parameter or snippet, every pipeline that uses it is flagged as stale, so you can rerun the affected pipelines and keep your data consistent without hunting down every place a value was used.

This page is for analysts and technical users who build pipelines. Start with [Parameters](#parameters) for single values or [Snippets](#snippets) for reusable logic.

## Parameters

A **Parameter** is a named value (a number, a text string, or a date) that you can plug into pipeline conditions and filters. Instead of typing `100` into ten different filters, you define a `Max_Units` parameter with value `100` and reference `{Max_Units}` everywhere. To change the threshold, you update the parameter once.

### Parameter types

| Type | Use for | Example value |
| --- | --- | --- |
| **Number** | Thresholds, counts, amounts | `100`, `0.75` |
| **Text** | Status values, category names, flags | `"Active"`, `"Yes"` |
| **Date** | Cut-off dates, reporting periods | `2026-04-01` |

### Reference syntax

To reference a parameter in a pipeline condition, use curly braces around the parameter name:

```plaintext
{parameter_name}
```

For example, a filter like `WHERE Discount < {Max_Discount}` will substitute the parameter's current value at runtime.

## Snippets

A **Snippet** is a reusable block of SQL code. Where parameters hold a single value, snippets hold logic, such as a SQL fragment, a subquery, or a WHERE clause. Snippets are embedded in tasks using double-brace syntax:

```sql
SELECT {{column_list}} FROM orders WHERE {{standard_date_filter}}
```

Snippets can also reference parameters internally, so you can parameterize complex logic. A snippet's language is always SQL.

## The parameters library

Open **Data Library** in the left sidebar, then click the **Parameters** tab (next to **Datasets** and **Automations**) to see all parameters and snippets for the current project. The tab appears only when the feature is enabled for your workspace, and creating or duplicating items requires a plan that includes Parameters; on other plans the **New Parameter** button shows a plan badge.

![Parameters library with a General group of three parameters, a Search box, Filter, and New Parameter button, and Name, Value, Subtype, and Uses columns](https://docs.mammoth.io/api/v1/images/20260418_190007_parameters-list1.jpg)

The library shows every parameter and snippet grouped by **category**. Each row displays:

- **Name**: the identifier used in `{name}` references
- **Description**: what this parameter represents
- **Value**: the current value
- **Subtype**: Number, Text, or Date (for parameters); SQL (for snippets)
- **Uses**: how many pipelines reference this parameter or snippet

Stale rows are highlighted. A banner at the top, **N parameter(s) updated. Rerun affected pipelines to apply changes.**, offers **Rerun stale pipelines**.

### Searching and filtering

Use the **Search parameters** box to find by name. Click **Filter** to narrow by type (parameters or snippets), subtype (Date, Number, Text, SQL), or category. **Group by** switches the table between None, Category, and Type (Category is the default). The **Learn more** icon links to help.

## Creating a parameter

**Prerequisite**: You have Edit-level access to the project.

1. Click **New Parameter** in the toolbar.
2. In the **New Parameter** dialog, choose the **Parameter** card, then fill in the form:

| Field | Required | Notes |
| --- | --- | --- |
| **Name** | Yes | Must start with a letter or underscore. Can contain letters, numbers, underscores. No spaces. Max 100 characters. |
| **Type** | Yes | Number, Text, or Date. Cannot be changed after creation. |
| **Value** | Yes | Must match the selected type. Dates use a date picker and are stored as YYYY-MM-DD. |
| **Category** | No | Assign to an existing category, or leave in **General**. Under "More options". |
| **Description** | No | Shown in the library and in the parameter picker. Under "More options". |

3. Click **Create Parameter**.

**Expected result**: The parameter appears in the library under its category.

> **Scope:** every parameter created from this dialog is **Project**-scoped, so there's no Scope field to set here. See [Scope: Project vs workspace](#scope-project-vs-workspace).

> **Note:** Parameter names must be unique within their scope. A project-scoped parameter named `Threshold` and a workspace-scoped parameter named `Threshold` can coexist, but you cannot have two project-scoped parameters with the same name.

## Editing a parameter

**Prerequisite**: You have Edit-level access to the project.

Click any parameter in the library to open its detail panel, then click **Edit**. You can also click the edit icon that appears when you hover over a row.

![Parameter detail panel for is_transaction with Edit and duplicate buttons, Properties showing value, category, reference syntax, and scope, and an empty Uses section](https://docs.mammoth.io/api/v1/images/20260418_190110_parameter-detail-panel1.jpg)

You can update the value, description, and category. The **Name** is read-only once the parameter exists ("Name can't be edited"), and the **Type** and **Scope** cannot be changed.

**What happens when you save an edit:**

- All pipelines that reference this parameter are flagged as **stale**. The detail panel shows **Stale in N pipelines** with a **Rerun** button.
- Stale banners with a **Rerun** button also appear in the SQL rule, Apply Filter, and Data check panels that use the changed value.
- The change is recorded in the parameter's history (visible in the detail panel).

## Viewing parameter dependencies

Every parameter's detail panel shows a **Uses** section listing each pipeline that references it, shown as a path of project, dataset, and view:

![Parameter detail panel for Pending_units with Uses 1, listing the path Marketing / Store Transaction / View 1](https://docs.mammoth.io/api/v1/images/20260418_190154_parameter-uses-panel1.jpg)

This tells you exactly what will be affected before you make a change.

## Using a parameter in a pipeline condition

When adding a condition to a pipeline filter, select **Parameter** as the value source in the third dropdown. A picker appears showing all available parameters:

![Add Condition dialog with Discount is less than Parameter chosen and a picker listing Pending_units, Number 100, with a New Parameter link](https://docs.mammoth.io/api/v1/images/20260418_190227_add-condition-parameter-picker1.jpg)

**Prerequisite**: A parameter exists.

1. Open a pipeline and add or edit a filter condition.
2. In the value column (third dropdown), select **Parameter**.
3. In the picker that appears, search for and select the parameter.
4. The condition now uses the parameter. To create one without leaving the condition, use the **New Parameter** link in the picker.
5. At runtime, Mammoth substitutes the current parameter value.

Parameters can also be used as inputs in Data check.

**Expected result**: The filter uses the parameter's current value each time the pipeline runs.

## Stale pipelines

When a parameter value changes, every pipeline using it is marked **stale**, meaning its output may no longer reflect the current parameter value. Mammoth does not rerun stale pipelines on its own; you start the rerun.

- Stale parameters are highlighted in the library, and the banner at the top offers **Rerun stale pipelines**.
- The detail panel shows **Stale in N pipelines** with a **Rerun** button, and the SQL rule, Apply Filter, and Data check panels show their own stale banner with **Rerun**.
- A rerun starts **from the first task that uses the changed parameter**, not from the beginning, so unchanged upstream tasks are not re-run.

## Organizing with categories

Both parameters and snippets can be grouped into **categories** for easier navigation. By default, all items go into **General**.

Category headings in the library have inline rename and delete icons. To add or manage categories, click **+ Manage** next to the category pills under **More options** when you create or edit an item. The **Manage categories** dialog lets you name categories and give them colors.

Deleting a category moves its items back to **General**. It does not delete the parameters or snippets themselves.

## Duplicating a parameter or snippet

Open the detail panel (or hover over a row) and click the **duplicate icon** next to **Edit**. The **Duplicate Parameter** or **Duplicate Snippet** dialog opens with the name pre-filled as `{name}_copy`. Change the name or value if you like, then click **Create Duplicate**. Nothing is created until you click it. If the `_copy` name is already taken, you get "Name already in use", so choose another name.

## Deleting a parameter or snippet

Open the detail panel and click the **trash icon** at the right of the header.

- If no pipeline references the item, a confirmation asks "Are you sure you want to delete {name}? This action cannot be undone." Click **Delete** to confirm.
- If a pipeline references it, the dialog says the item is used by pipelines and cannot be deleted, and lists each view with its task count. It offers only **Close**. Remove the references first, then delete.

## Working with snippets

### Creating a snippet

Creating a snippet follows the same flow as parameters:

1. From the Parameters library, click **New Parameter** and choose the **Snippet** card.
2. Set:
   - **Name**: same naming rules as parameters
   - **Value**: the reusable SQL code block. There's no language selector; snippets are always SQL. Type `/param` in the field to reference a parameter.
   - **Category** and **Description** (optional, under "More options")
3. Click **Create Snippet**.

**Expected result**: The snippet appears in the library and can be referenced with `{{name}}`.

The name rules are the same as for parameters. Saving fails with "Snippets cannot reference other snippets (no {{...}} allowed)" if the code contains another snippet reference.

> **Scope:** New parameters and snippets are always created as **Project**-scoped from this dialog—there is no Scope selector in the create form. Workspace-scoped items can exist (for example, created via the API), but you can't create one as Workspace-scoped from the current UI.

> **Restriction:** Snippet code cannot reference other snippets (no `{{...}}` patterns inside snippet code). Snippets *can* reference parameters using `{parameter_name}` syntax.

### Using a snippet in a task

In a SQL rule, click **Insert Snippet** and pick the snippet. Choose how to insert it:

- **Reference** inserts `{{name}}`, which stays linked to the snippet. Later edits to the snippet reach the task.
- **Paste value** inserts the snippet's current code as plain text, with no link to the snippet.

```sql
SELECT customer_id, SUM(amount)
FROM transactions
WHERE {{standard_date_filter}}
GROUP BY 1
```

At execution time, Mammoth substitutes the snippet's code in place of `{{standard_date_filter}}`.

### Snippet dependencies

Just like parameters, the snippet detail panel shows which pipelines use it and flags them as stale when the snippet code changes. Use **Rerun** to apply the change.

## Scope: Project vs workspace

|  | Project scope | Workspace scope |
| --- | --- | --- |
| **Visible in** | This project only | All projects in the workspace |
| **Reference syntax** | `{name}` / `{{name}}` | Same syntax |
| **Name uniqueness** | Unique within this project | Unique across the workspace |
| **Best for** | Dataset-specific thresholds, view-specific logic | Shared org-wide standards (for example, fiscal year start or company-wide thresholds) |

> **Creating Workspace-scoped items:** the **New Parameter** / **New Snippet** dialog in the Data Library always creates a **Project**-scoped item—there's currently no Scope selector there. Workspace-scoped parameters and snippets can exist in your workspace (for example, created via the API), and once they exist you'll see and reference them like any other, but you can't create one as Workspace-scoped from this dialog today.

> **Scope cannot be changed** after a parameter or snippet is created.

## History and audit trail

Every parameter and snippet keeps a history of changes in its detail panel. Each entry shows how long ago the change happened, with the old value struck through followed by the new value.

This makes it easy to audit why a downstream dataset changed. Trace it back to a specific parameter edit.

## Related articles

- [The dataset panel](https://docs.mammoth.io/learn/data-library/dataset-panel/): Full reference for the dataset side panel, including Settings and Batches
- [Add or replace data](https://docs.mammoth.io/learn/data-library/add-or-replace-data/): Step-by-step guide to appending or replacing data in a dataset

---
Source: https://docs.mammoth.io/learn/data-library/parameters-snippets.md · Updated: 2026-10-13