Validate Primary Key
data.validate_primary_key
Overview
You send a rectangular table and 1 to 8 key columns. We report whether the key is unique and non-null, with duplicate and null counts. Diagnostics carry 0-based row indices and a SHA-256 fingerprint of the canonical key, never the key values. INTEGER 1 and NUMBER 1.0 stay distinct. This is not a database constraint and does not rewrite rows.
Printing duplicate keys into logs and tickets leaks identifiers. Fingerprints and row indices are enough to locate the row without repeating the value.
Reliability
Duplicates are success with valid false, not a typed failure. DUPLICATE_COLUMN — trigger: the table or keyColumns repeats a name; retryable: no; next: make names unique. SHAPE_INVALID — trigger: a row is not rectangular; retryable: no; next: fix that row. TYPE_MISMATCH — trigger: a cell does not match its declared type; retryable: no; next: fix the cell. ITEM_LIMIT_EXCEEDED — trigger: the table exceeds 1,000,000 cells; retryable: no; next: split the table. COLUMN_CONFLICT — trigger: a keyColumns entry is not in the table; retryable: no; next: send a column that exists.
Context footprint
Counts plus at most 500 fingerprint diagnostics. A successful call costs 1 execution credit.
When to use it
When 1 to 8 named columns must be unique and you need row indices plus a SHA-256 fingerprint rather than the key values themselves.
When you want duplicates deleted, or uniqueness that ignores INTEGER versus NUMBER.
Scope
Non-goals
- Does not create a database constraint
- Does not drop or rewrite duplicate rows
- Does not approximate uniqueness
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| table | object | Yes | Closed rectangular table: typed columns plus row-major arrays of JSON scalars or null. |
| keyColumns | array | Yes | From 1 through 8 unique NFC column names forming the key, in declared order. |
| nulls | string | No | INVALID rejects null keys; DISTINCT treats them as unique. Omit it for INVALID. |
| caseSensitivity | string | No | SENSITIVE compares as sent; UNICODE_CASEFOLD NFC-lowers with Locale.ROOT. Omit it for SENSITIVE. |
| maxViolations | integer | No | Diagnostic cap; omit it for 500. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| valid | boolean | Yes | True only when duplicateCount and nullCount are both 0. |
| duplicateCount | integer | Yes | Non-negative count for this result. |
| nullCount | integer | Yes | Non-negative count for this result. |
| violationCount | integer | Yes | Non-negative count for this result. |
| truncated | boolean | Yes | True when diagnostics stopped at maxViolations. |
| rowCount | integer | Yes | Non-negative count for this result. |
| diagnostics | array | Yes | From 0 through 500 fingerprint diagnostics in scan order, never raw keys. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"data.validate_primary_key","input":{"table":{"columns":[{"name":"id","type":"STRING"}],"rows":[["a"],["b"]]},"keyColumns":["id"]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("data.validate_primary_key", {"table":{"rows":[["a"],["b"]],"columns":[{"type":"STRING","name":"id"}]},"keyColumns":["id"]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| DUPLICATE_COLUMN | 400 | No | The request payload failed this skill's input validation. |
| SHAPE_INVALID | 400 | No | The request payload failed this skill's input validation. |
| TYPE_MISMATCH | 400 | No | The request payload failed this skill's input validation. |
| ITEM_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| COLUMN_CONFLICT | 400 | No | The request payload failed this skill's input validation. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not create a database constraint
- Does not drop or rewrite duplicate rows
- Does not approximate uniqueness
- Deleting duplicates
- Fuzzy or phonetic uniqueness
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "data.validate_primary_key",
"input": {
"table": {
"rows": [
[
"a"
],
[
"b"
]
],
"columns": [
{
"type": "STRING",
"name": "id"
}
]
},
"keyColumns": [
"id"
]
}
}Examples
Two distinct string keys are valid
{
"table": {
"rows": [
[
"a"
],
[
"b"
]
],
"columns": [
{
"type": "STRING",
"name": "id"
}
]
},
"keyColumns": [
"id"
]
}{
"duplicateCount": 0,
"truncated": false,
"valid": true,
"violationCount": 0,
"diagnostics": [],
"nullCount": 0,
"rowCount": 2
}Duplicate string key returns fingerprint
{
"table": {
"rows": [
[
"a"
],
[
"a"
]
],
"columns": [
{
"type": "STRING",
"name": "id"
}
]
},
"keyColumns": [
"id"
]
}{
"duplicateCount": 1,
"truncated": false,
"valid": false,
"violationCount": 1,
"diagnostics": [
{
"fingerprint": "b788d768c7ed152e2094e2fc155e009c32bf2195e5aded0626b209e8bdd05366",
"code": "DUPLICATE_KEY",
"severity": "ERROR",
"rowIndices": [
0,
1
]
}
],
"nullCount": 0,
"rowCount": 2
}Recommended use cases
- Prove an extract's id is unique before a load, without logging the ids
- Distinguish INTEGER 1 from NUMBER 1.0 on a composite key
Avoid for
- Deleting duplicates
- Fuzzy or phonetic uniqueness
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.