> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/fabricate/data-masking/masking-complete/masking-run-workflow.md).

# Configuring and running the masking workflow

Before you can run a masking workflow, you must establish the connection to the destination database. Make sure to update the workflow to add the destination information.

`Update the Mask source data workflow to add outputdata as the destination database.`

For more information about the requirements for each data platform, go to [Database requirements for masking](https://docs.google.com/document/d/1ArO1uf8MO42qqdBMcnRptRE9sL0UIE6E-73MjqCDuKE/edit?tab=t.0#heading=h.fi372925x7t6).

## Configuring the masking mode for destination records

On the workflow details for a masking workflow, the **Mode** option determines how the workflow interacts with the existing records in the destination database.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FmXKLNjYLmdy9lOjZyClb%2FDatabase_MaskingWorkflowMode.png?alt=media&amp;token=9cffe5e8-e5e8-493a-b800-782050008b65" alt=""><figcaption><p>Mode options for a masking workflow</p></figcaption></figure>

The options are:

* **truncate -** Fabricate clears all of the records from the destination database, then uses the masked data to populate it.
* **append -** Fabricate uses the masked data to add new records to the destination database. It does not touch the existing records.
* **resume -** Used to continue a masking run that did not complete.

You can also prompt the Data Agent to configure the mode or to customize the mode for individual tables.

For example:

`Configure the workflow to append the masked records to the existing records in the destination database.`

`Do not mask records for customers where the last name is test.`

`Exclude the legacy table from masking.`

## Configuring the masking scope

On the workflow details for a masking workflow, the Scope option determines whether the workflow runs the masking for the entire database or for a smaller subset.

From the **Scope** dropdown list, select the scope to use for the next workflow run.

You can also prompt the Agent to set the scope. For example:

`Run the masking workflow for a test set of 200 customers and their related records. Retrieve the same sample for every run.`

`Run the masking workflow for customers who are located in New Jersey as well as their related records.`

### Full database

To mask the full database, select **full**.

For this option, Fabricate masks all of the records in the source database.

### Random sample

To mask a random sample of records from the database, select **sample**.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FcFmDPXLMRZGvNjnM3fQK%2FDatabase_MaskingWorkflowScopeSample.png?alt=media&amp;token=8d80030b-1509-46b8-ba40-1376020408d9" alt=""><figcaption><p>Configuring the workflow to mask a random sample of records</p></figcaption></figure>

For example, for a retail transactions database, the random sample might be a subset of customers.

For a random sample, you specify:

* **Number of \<record type>.** The number of records to include in the sample.
* **Sample seed -** Optional. When you provide a sample seed, then every time you run the workflow, Fabricate chooses the same set of sample rows.
* **Include child rows -** Whether to include other records that are tied to the base records.\
  \
  For example, if the sample includes 20 customers, then this setting determines whether to also mask the order and payment method records that are tied to those customers.

### Records that match a condition

To mask the data based on a SQL expression to identify the base records to include, select **entities**.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FyIfq5iuimNyOV3sPXJXv%2FDatabase_MaskingWorkflowScopeCondition.png?alt=media&amp;token=3e8e8bc6-1611-4dec-85ce-3e4c54dea2a5" alt=""><figcaption><p>Configuring the workflow to mask records that match a SQL filter</p></figcaption></figure>

For this option, you provide a SQL expression to identify the base records to include.

For example, for a retail transactions database, you might set a condition to only include customers located in New Jersey.

For a condition scope, you specify:

* **\<record type> filter -** The SQL expression to specify the condition.
* **Sample seed -** Optional.
* **Include child rows -** Whether to include other records that are tied to the matching records.\
  \
  For example, if the condition specifies to mask customers from New Jersey, then this setting determines whether to also mask the order and payment method records that are tied to those customers.

## Configuring a statistics seed for the masking

A statistics seed is used to generate consistent values across runs and workflows.

Fabricate provides a default seed.

To provide your own seed, in the **Masking seed** field, provide the statistics seed to use.

## Running the masking workflow

To run the masking based on the current workflow and masking configuration, click **Run**.

You can also prompt the Data Agent to run the workflow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tonic.ai/fabricate/data-masking/masking-complete/masking-run-workflow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
