> For the complete documentation index, see [llms.txt](https://docs.telm.ai/telmai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telm.ai/telmai/monitoring-data/monitors-management/configuring-data-binning.md).

# Configuring Data-Binning

Data binning enables you to automatically separate valid data from problematic data at the source, ensuring that only high-quality records flow through your data pipelines. By routing bad or suspicious data to a separate location for review, you can prevent costly downstream processing of invalid records and maintain pipeline efficiency.

Telmai's data binning uses your row checks to sort records into two bins after each scan:

* **Valid Data**: Records that meet all [defined data quality rules](https://docs.telm.ai/telmai/monitoring-data/user-defined-monitors/record-validation-rules.md) and continue through your pipeline
* **Invalid Data**: Records that violate quality rules and are flagged for review

This automated quality gate helps you maintain data integrity while reducing the cost of processing bad data through expensive transformation and analytics pipelines.

### Prerequisites

Before configuring data binning, ensure you have:

1. A connected data source in Telmai
2. At least one enabled row check on the asset: a [Row quality check](https://docs.telm.ai/telmai/monitoring-data/user-defined-monitors/record-validation-rules.md) or a [SQL row check](https://docs.telm.ai/telmai/monitoring-data/user-defined-monitors/sql-based-rules.md)
3. A destination with the right permissions: Amazon S3, Google Cloud Storage, Azure, or a Databricks Delta schema

## Configuration Steps

### Step 1: Set the ID attributes

Data binning sorts individual records, so the asset needs ID attributes that identify each record.

1. Open the asset from **Assets** and go to its **Settings** tab.
2. Under **Records**, choose the **ID attributes**, for example `record_id`, `transaction_id` or `user_id`.
3. Click **Save changes**.

See [Asset Settings](https://docs.telm.ai/telmai/connect-to-data/configuring-a-data-source.md#id-attribute).

### Step 2: Create row checks

Create one or more row checks that decide whether a record is valid. See [Creating a Monitor](https://docs.telm.ai/telmai/monitoring-data/monitors-management/creating-a-monitor.md).

### Step 3: Set up data binning <a href="#step-3-enable-data-binning" id="step-3-enable-data-binning"></a>

1. On the asset's **Overview** tab, find **Data binning** in the **Remediation & actions** card and click **Set up data binning**. The button is disabled until the asset has at least one enabled row check.
2. In **Data binning settings**, turn on **Enabled**.
3. Under **Attached rule monitors**, choose the row checks that decide which records are valid.
4. Choose the **Destination**: **AWS S3**, **Google Cloud Storage**, **Azure File** or **Databricks**.
5. For a storage destination, enter:
   * **Valid data path** — where records that pass all the checks go, for example `s3://your-bucket/valid-data/`.
   * **Invalid data path** — where records that fail a check go, for example `s3://your-bucket/invalid-data/`.
   * **Output format** — **JSON**, **CSV** or **PARQUET**.
6. For **Databricks**, enter:
   * **Catalog** — optional. Leave it empty to use the connection's default catalog.
   * **Schema** — must already exist in Databricks.
   * **Valid data table** and **Invalid data table** — created on the first scan if they don't exist.
7. Click **Save**.

To stop binning, click **Edit** on the **Data binning** row and turn off **Enabled**. Its attached row checks are detached when you save. To start it again, click **Turn on**.

### Step 4: Check the results

Binning runs on the asset's next scan. The **Data binning** row on the **Overview** tab shows the **Destination** and output format, where **Failing rows** and **Passing rows** are sent, and how many row checks it uses under **Monitors**. Click **See failed rows** to review the failing rows in [Reports > Row checks](https://docs.telm.ai/telmai/monitoring-data/reports.md#row-checks), and check the valid and invalid destinations for the files or tables.

### Storage Permissions

#### AWS S3

Ensure your AWS credentials have the following permissions:

* `s3:PutObject` - Write objects to buckets
* `s3:DeleteObject` - Remove objects from buckets
* `s3:ListBucket` - List bucket contents

#### GCP Cloud Storage

Your service account must have the following IAM roles:

* **Storage Legacy Bucket Writer** - Write access to buckets
* **Storage Legacy Object Owner** - Full control over objects

#### Azure Blob Storage

Your SAS token or service principal must have:

* **Write** permissions - Create and write blobs
* **Delete** permissions - Remove blobs (required for data binning operations)

## Feature Limitation

* **Group Assets**: Data binning is not currently supported for assets belonging to a group. Configure binning at the individual asset level.
* **Data Diff Compatibility**: The Data Diff feature is not available for assets with data binning enabled.
* **Scan Frequency**: Binning runs on every scan of the asset. Ensure your scan frequency aligns with your data freshness requirements.
* **Nested Data**: Assets with nested columns (for example, nested JSON or nested XML files) cannot be binned to the following destinations:

  * **CSV** output format, because CSV cannot hold nested values.
  * **Databricks** table destinations.

  For these assets, use a cloud storage destination (Amazon S3, Google Cloud Storage, or Azure Blob Storage) with **JSON** or **Parquet** output.

{% hint style="warning" %}
Saving these combinations is currently accepted, but the next scan of the asset fails and no data is loaded for that scan. Choose a cloud storage destination with JSON or Parquet output before enabling data binning on an asset with nested columns.
{% endhint %}

## Related Documentation

* [Creating a Monitor](https://docs.telm.ai/telmai/monitoring-data/monitors-management/creating-a-monitor.md)
* [Managing Existing Monitors](https://docs.telm.ai/telmai/monitoring-data/monitors-management/managing-existing-monitors.md)
* [Configuring Notifications](https://docs.telm.ai/telmai/monitoring-data/monitors-management/configuring-notifications.md)
* [Data Binning](https://docs.telm.ai/telmai/remediation/data-binning.md)
