Reshape Wide To Long
data.reshape_wide_to_long
Overview
You send a rectangular table, id columns, and either valueColumns or a RE2 valueColumnPattern. We emit one row per source row and value column, in that order, with nameColumn and valueColumn you name. dropNullValues is false unless you opt in. The 100,000-row ceiling is checked before allocation. This is not a pivot, and it does not use a backtracking regex engine.
Unpivoting in hash-map order, or allocating a 100,001-row result then failing, is how a reshape becomes non-deterministic and unbounded. Selection order and the ceiling are checked first.
Reliability
Pattern matches keep original column order. Overlap between ids and values is refused. DUPLICATE_COLUMN — trigger: idColumns or valueColumns repeats a name; retryable: no; next: make the list unique. SHAPE_INVALID — trigger: a source 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: source rows times value columns exceed 100,000 before dropNullValues; retryable: no; next: select fewer columns. COLUMN_CONFLICT — trigger: a listed column is missing or a generated name collides; retryable: no; next: rename the generated columns. RESHAPE_INVALID — trigger: both or neither selector, an empty match, or an invalid RE2 pattern; retryable: no; next: send exactly one selector.
Context footprint
One long row per selected cell, plus counts. A successful call costs 2 execution credits.
When to use it
When measure columns should become name/value pairs in source-row then column order, with the 100,000-row ceiling checked before allocation.
When you need to aggregate while reshaping, or when the pattern requires backtracking.
Scope
Non-goals
- Does not aggregate or pivot
- Does not use a backtracking regex engine
- Does not group by semantics beyond the listed columns
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
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 may contain submitted or transformed 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. |
| idColumns | array | No | From 0 through 256 unique id columns copied onto every long row; omit it for none. |
| valueColumns | array | No | From 1 through 256 value columns in long-row order; omit it when valueColumnPattern is set. |
| valueColumnPattern | string | No | RE2 pattern matched in original column order; omit it when valueColumns is set. |
| nameColumn | string | Yes | Generated STRING column that receives the source column name. |
| valueColumn | string | Yes | Generated column that receives the cell. |
| dropNullValues | boolean | No | Whether null values are dropped; omit it for false. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| columns | array | Yes | Id columns then nameColumn then valueColumn, 1 through 256 unique NFC names. |
| rows | array | Yes | From 0 through 100,000 long rows in source-row then value-column order. |
| columnCount | integer | Yes | Non-negative count for this result. |
| rowCount | integer | Yes | Non-negative count for this result. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"data.reshape_wide_to_long","input":{"table":{"columns":[{"name":"id","type":"STRING"},{"name":"m1","type":"INTEGER"}],"rows":[["a",1]]},"idColumns":["id"],"valueColumns":["m1"],"nameColumn":"metric","valueColumn":"amount"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("data.reshape_wide_to_long", {"idColumns":["id"],"valueColumns":["m1","m2"],"nameColumn":"metric","valueColumn":"amount","table":{"rows":[["a",1,2]],"columns":[{"type":"STRING","name":"id"},{"type":"INTEGER","name":"m1"},{"type":"INTEGER","name":"m2"}]}});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. |
| RESHAPE_INVALID | 400 | No | The request payload failed this skill's input validation. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not aggregate or pivot
- Does not use a backtracking regex engine
- Does not group by semantics beyond the listed columns
- Pivoting long data back to wide
- PCRE backtracking patterns
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "data.reshape_wide_to_long",
"input": {
"idColumns": [
"id"
],
"valueColumns": [
"m1",
"m2"
],
"nameColumn": "metric",
"valueColumn": "amount",
"table": {
"rows": [
[
"a",
1,
2
]
],
"columns": [
{
"type": "STRING",
"name": "id"
},
{
"type": "INTEGER",
"name": "m1"
},
{
"type": "INTEGER",
"name": "m2"
}
]
}
}
}Examples
Listed value columns keep source order
{
"idColumns": [
"id"
],
"valueColumns": [
"m1",
"m2"
],
"nameColumn": "metric",
"valueColumn": "amount",
"table": {
"rows": [
[
"a",
1,
2
]
],
"columns": [
{
"type": "STRING",
"name": "id"
},
{
"type": "INTEGER",
"name": "m1"
},
{
"type": "INTEGER",
"name": "m2"
}
]
}
}{
"columns": [
{
"type": "STRING",
"name": "id"
},
{
"type": "STRING",
"name": "metric"
},
{
"type": "INTEGER",
"name": "amount"
}
],
"rowCount": 2,
"rows": [
[
"a",
"m1",
1
],
[
"a",
"m2",
2
]
],
"columnCount": 3
}Pattern order follows original columns
{
"idColumns": [
"id"
],
"nameColumn": "metric",
"valueColumn": "amount",
"table": {
"rows": [
[
"a",
2,
1
]
],
"columns": [
{
"type": "STRING",
"name": "id"
},
{
"type": "INTEGER",
"name": "m2"
},
{
"type": "INTEGER",
"name": "m1"
}
]
},
"valueColumnPattern": "^m"
}{
"columns": [
{
"type": "STRING",
"name": "id"
},
{
"type": "STRING",
"name": "metric"
},
{
"type": "INTEGER",
"name": "amount"
}
],
"rowCount": 2,
"rows": [
[
"a",
"m2",
2
],
[
"a",
"m1",
1
]
],
"columnCount": 3
}Recommended use cases
- Turn month_1, month_2 measure columns into month/value rows
- Select measure columns with a RE2 prefix in original order
Avoid for
- Pivoting long data back to wide
- PCRE backtracking patterns
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.