Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Reshape Wide To Long

data.reshape_wide_to_long

ProductionBounded custom (Class B)Deterministicstrictmoderatev1.0.0
No network

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

Note
Unpivots selected columns into name and value rows in source-row then column order.

Non-goals

  • Does not aggregate or pivot
  • Does not use a backtracking regex engine
  • Does not group by semantics beyond the listed columns

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

data-transformation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call2 credits

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive output possible
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
tableobjectYesClosed rectangular table: typed columns plus row-major arrays of JSON scalars or null.
idColumnsarrayNoFrom 0 through 256 unique id columns copied onto every long row; omit it for none.
valueColumnsarrayNoFrom 1 through 256 value columns in long-row order; omit it when valueColumnPattern is set.
valueColumnPatternstringNoRE2 pattern matched in original column order; omit it when valueColumns is set.
nameColumnstringYesGenerated STRING column that receives the source column name.
valueColumnstringYesGenerated column that receives the cell.
dropNullValuesbooleanNoWhether null values are dropped; omit it for false.

Output schema

FieldTypeRequiredDescription
columnsarrayYesId columns then nameColumn then valueColumn, 1 through 256 unique NFC names.
rowsarrayYesFrom 0 through 100,000 long rows in source-row then value-column order.
columnCountintegerYesNon-negative count for this result.
rowCountintegerYesNon-negative count for this result.

API contract

POST /v1/execute
curl
curl -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"}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
DUPLICATE_COLUMN400NoThe request payload failed this skill's input validation.
SHAPE_INVALID400NoThe request payload failed this skill's input validation.
TYPE_MISMATCH400NoThe request payload failed this skill's input validation.
ITEM_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.
COLUMN_CONFLICT400NoThe request payload failed this skill's input validation.
RESHAPE_INVALID400NoThe request payload failed this skill's input validation.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "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

Inputjson
{
  "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"
      }
    ]
  }
}
Expected outputjson
{
  "columns": [
    {
      "type": "STRING",
      "name": "id"
    },
    {
      "type": "STRING",
      "name": "metric"
    },
    {
      "type": "INTEGER",
      "name": "amount"
    }
  ],
  "rowCount": 2,
  "rows": [
    [
      "a",
      "m1",
      1
    ],
    [
      "a",
      "m2",
      2
    ]
  ],
  "columnCount": 3
}
Tip
Two measure columns become two long rows in listed order

Pattern order follows original columns

Inputjson
{
  "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"
}
Expected outputjson
{
  "columns": [
    {
      "type": "STRING",
      "name": "id"
    },
    {
      "type": "STRING",
      "name": "metric"
    },
    {
      "type": "INTEGER",
      "name": "amount"
    }
  ],
  "rowCount": 2,
  "rows": [
    [
      "a",
      "m2",
      2
    ],
    [
      "a",
      "m1",
      1
    ]
  ],
  "columnCount": 3
}
Tip
RE2 ^m matches m2 then m1 because that is original column order
  • 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

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.

Tags

transformationreshapedata