# CSV Mask (CsvMaskGenerator)

The [CSV Mask](https://docs.tonic.ai/app/generation/generators/generator-reference/csv-mask) generator allows to assign specific generators to specific indexes. You can also use the generator that is assigned to a specific index as the default. This applies the generator to every index that does not have an assigned generator.

## Link object structure <a href="#generator-api-csv-mask-link-object" id="generator-api-csv-mask-link-object"></a>

For the CSV Mask generator, there is a link object for each index to assign a generator to.

The generator does not itself support consistency or differential privacy.

The `metadata` object is populated from the [`CsvMaskMetadata`](https://app.tonic.ai/apidocs/index.html#/models/CsvMaskMetadata) object, and includes:

* `pathExpression`, which is the index to apply the sub-generator to.
* The delimiter used to separate the CSV values.
* Whether to apply that generator to indexes that are not assigned a generator.
* The `subGeneratorMetadata` object, which identifies and configures the sub-generator.

Here is the basic structure of a link object for a CSV Mask sub-generator.

{% code overflow="wrap" %}

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "metadata": {
    "generatorId": "CsvMaskGenerator",
    "presetId": "CsvMaskGenerator",
    "customValueProcessor": "string", //If custom value processor applied to the generator
    "pathExpression": "string",
    "delimiter": "string",
    "isDefaultGenerator": boolean,
    "subGeneratorMetadata": {
      "presetId": "string",
      "generatorId": "string",
       //Metadata for the selected sub-generator
      "customValueProcessor": "string" //If custom value processor applied to the sub-generator
    }
  }
}
```

{% endcode %}

## Example replacement <a href="#generator-ref-csv-mask-replacement" id="generator-ref-csv-mask-replacement"></a>

This example replacement for the CSV Mask generator assigns generators to index 0 and index 1 of the column value. The delimiter is a comma.

For index 0, the Address generator is assigned, with an address type of City and consistency disabled.

For index 1, the Company Name generator is assigned, with consistency disabled.

Neither sub-generator is assigned as the default generator for other indexes.

```json
{
  "name": "word",
  "schema": "public",
  "table": "customers",
  "links": [
    {
      "schema": "public",
      "table": "customers",
      "column": "location"
      "metadata": {
        "generatorId": "CsvMaskGenerator",
        "presetId": "CsvMaskGenerator",
        "delimiter": ",",
        "pathExpression": "0",
        "isDefaultGenerator": false,
        "subGeneratorMetadata": {
          "presetId": "AddressGenerator",
          "generatorId": "AddressGenerator",
          "addressType": "City",
          "isConsistent": false
        }
      }
    },
    {
      "table": "customers",
      "schema": "public",
      "column": "location",
      "metadata": {
        "generatorId": "CsvMaskGenerator",
        "presetId": "CsvMaskGenerator",
        "delimiter": ",",
        "pathExpression": "1",
        "isDefaultGenerator": false,
        "subGeneratorMetadata": {
          "presetId": "CompanyNameGenerator",
          "generatorId": "CompanyNameGenerator",
          "isConsistent": false
        }
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-csv-mask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
