Max Length Check Examples
Three real-world scenarios that show how the Max Length check is typically used in production: guarding a fixed-width code, protecting a downstream column with a filter, and auditing free-text notes mid-cleanup. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.
The situation: The addresses table stores a two-letter country code. Values longer than two characters mean a country name or a padded value was written into the code column, which breaks every join against the country reference table.
Check configuration
| Field | Value |
|---|---|
| Rule | Max Length |
| Field | country_code |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Length | 2 |
| Array Element Context | Off |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Reference Data team) |
| Description | Country code must be at most 2 characters. |
| Tags | reference, format |
| Additional Metadata | jira: DATA-8601 |
| Status | Active |
Payload
{
"description": "Country code must be at most 2 characters.",
"rule": "maxLength",
"fields": ["country_code"],
"container_id": 145,
"coverage": 1,
"filter": null,
"properties": {"value": 2},
"tags": ["reference", "format"],
"additional_metadata": {"jira": "DATA-8601"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 12
}
Sample Data
| address_id | country_code | city |
|---|---|---|
| A-001 | BR | São Paulo |
| A-002 | BRA | Recife |
| A-003 | PT | Porto |
| A-004 | (null) | Unknown |
What gets flagged
Address A-002 holds a three-letter code. A-004 is NULL and passes without firing an anomaly. Coverage is 100%, so the failing row is reported as a Record Anomaly, naming the value and the limit it breaks.
Record Anomaly
country_code has the value BRA, which is longer than the maximum of 2
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read country_code"]
B --> C{"Is value NULL?"}
C -->|Yes| D["Row passes"]
C -->|No| E{"Is the length <= 2?"}
E -->|Yes| D
E -->|No| F["Flag row.<br/>Record Anomaly per failing row."]
Equivalent SQL
The situation: Records synced to an external CRM must fit its 100-character description column; anything longer is silently truncated on their side. Records that are not synced can hold any length and are out of scope.
Check configuration
| Field | Value |
|---|---|
| Rule | Max Length |
| Field | description |
| Filter | sync_to_crm = true |
| Custom Anomaly Description | Off |
| Length | 100 |
| Array Element Context | Off |
| Coverage | 100% |
| Owner | (check creator) |
| Anomaly Assignee | (Integrations team) |
| Description | Synced descriptions must fit the CRM's 100-character limit. |
| Tags | integration, format |
| Additional Metadata | jira: DATA-8644 |
| Status | Active |
Payload
{
"description": "Synced descriptions must fit the CRM's 100-character limit.",
"rule": "maxLength",
"fields": ["description"],
"container_id": 512,
"coverage": 1,
"filter": "sync_to_crm = true",
"properties": {"value": 100},
"tags": ["integration", "format"],
"additional_metadata": {"jira": "DATA-8644"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 29
}
Sample Data (filtered to sync_to_crm = true)
| record_id | sync_to_crm | description |
|---|---|---|
| R-01 | true | Annual maintenance contract |
| R-02 | true | Long free-text note copied from the ticket, 180 characters |
| R-03 | true | Renewal, standard terms |
Why the filter matters
The filter runs before the measurement, so records that are never synced are not tested against the external limit. Only synced rows are evaluated.
What gets flagged
R-02 exceeds the CRM's column limit and would be truncated on delivery. Coverage is 100%, so the failure is reported as a Record Anomaly, and the message names the filter that scoped the evaluation.
Record Anomaly
description has the value Long free-text note copied from the ticket, 180 characters, which is longer than the maximum of 100 (applied to records where sync_to_crm = true)
Flowchart
graph TD
A["Apply filter: sync_to_crm = true"] --> B["Read description"]
B --> C{"Is the length <= 100?"}
C -->|Yes| D["Row passes"]
C -->|No| E["Flag row.<br/>Message names the filter:<br/>applied to records where sync_to_crm = true"]
Equivalent SQL
The situation: A legacy note column holds pasted content well beyond the 500 characters the new schema allows. A cleanup job is trimming them, so a small fraction of oversized rows is expected and the check tolerates up to 0.5% failures.
Check configuration
| Field | Value |
|---|---|
| Rule | Max Length |
| Field | note |
| Filter | (none) |
| Custom Anomaly Description | Off |
| Length | 500 |
| Array Element Context | Off |
| Coverage | 99.5% |
| Owner | (check creator) |
| Anomaly Assignee | (Legacy Migration team) |
| Description | Notes must fit the 500-character schema limit. |
| Tags | legacy, format |
| Additional Metadata | jira: DATA-8688 |
| Status | Active |
Payload
{
"description": "Notes must fit the 500-character schema limit.",
"rule": "maxLength",
"fields": ["note"],
"container_id": 733,
"coverage": 0.995,
"filter": null,
"properties": {"value": 500},
"tags": ["legacy", "format"],
"additional_metadata": {"jira": "DATA-8688"},
"anomaly_message_field": null,
"template_id": null,
"status": "Active",
"owner_id": 7,
"default_anomaly_assignee_id": 41
}
Sample Data
| note_id | note | migrated |
|---|---|---|
| N-01 | Customer confirmed the renewal by phone. | true |
| N-02 | Pasted email thread, 2,400 characters | false |
| N-03 | Pasted contract clause, 1,100 characters | false |
| N-04 | (null) | false |
What gets flagged
Notes N-02 and N-03 still hold pasted content beyond the limit. N-04 is NULL, so it passes without firing an anomaly but still counts in the scanned total. Only 50% of the rows pass, which is below the 99.5% coverage threshold, so the check reports a single Shape Anomaly for the dataset with a sample of the offending rows. Coverage below 100% does not produce Record Anomalies.
Shape Anomaly
note values are longer than the maximum of 500, affecting 2 of 4 asserted records
Flowchart
graph TD
A["No filter, evaluate all rows"] --> B["Read note"]
B --> C{"Is value NULL?"}
C -->|Yes| D["Row passes"]
C -->|No| E{"Is the length <= 500?"}
E -->|Yes| D
E -->|No| F["Flag row.<br/>Passing rate falls below the 99.5%<br/>coverage, so one Shape Anomaly is reported."]
Equivalent SQL
See Also
-
How It Works
The complete reference: definition, field scope, the length property, NULL handling, arrays, filter behavior, and coverage.
-
Anomaly Reporting
The anomaly messages the check produces, what the numbers mean, Source Records highlighting, and Custom Anomaly Description.
-
Best Practices
Guidelines for choosing the length, pairing rules, and keeping the signal clean.
-
Permissions
The team permission each action needs: view, create, edit, archive, restore, and delete.