Skip to main content

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

MicroSkills Reference

Table Schema Comparator

database.compare_table_schema

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

Overview

You describe the table as it is and as you mean it to be — columns with their types, nullability and defaults, plus constraints and indexes — and we sort every difference into three buckets against one yardstick: whether the data already stored survives and whether the writes the old shape accepted still succeed. Conditional is its own bucket rather than a hedge: an integer becoming a float or a default being rewritten is lossy only for certain rows, and we say so instead of crying wolf or waving it through. A rename is only ever one you declare, an expression is compared as text and never evaluated, and no default value, check expression or enum member is repeated back to you.

Reviewing a table change by eye is where outages come from: the column that went NOT NULL reads like a tidy-up, and the integer that became a float reads like nothing at all. This applies one published yardstick to every difference and, where the answer honestly depends on the rows you hold, says that instead of picking a side.

Reliability

Same pair in, same buckets out, in a published order: change kind first, then path, so two runs compare byte for byte and a stored report stays diffable. A transition we publish no rule for comes back conditional with TYPE_CHANGE_UNCLASSIFIED rather than assumed safe, and where an engine is more permissive than the matrix we still say breaking. What stops the call: TABLESCHEMA_INPUT_INVALID — trigger: a side is missing, carries no columns, or an entry has the wrong shape, such as a default with kind LITERAL and no literal; retryable: no; next: fix the entry and resend. TABLESCHEMA_COLUMN_NAME_DUPLICATE — trigger: one side names the same column twice; retryable: no; next: drop the duplicate, since a comparison against it has no single answer. TABLESCHEMA_TYPE_INVALID — trigger: a parameter outside its range, such as a DECIMAL scale above its precision, or a parameter on a family that does not take it, such as length on INT32; retryable: no; next: send the parameters that family takes. TABLESCHEMA_TYPE_UNSUPPORTED — trigger: a family we do not publish, or an ARRAY of ARRAY, which nests one level only; retryable: no; next: pick a published family. TABLESCHEMA_CONSTRAINT_INVALID — trigger: an unknown kind, a CHECK with no expression, columns naming something its own side does not declare, two constraints that cannot be told apart, a second PRIMARY_KEY, or a referential property on something other than a FOREIGN_KEY; retryable: no; next: correct the constraint. TABLESCHEMA_CONSTRAINT_UNMATCHABLE — trigger: a constraint with neither a name nor columns, so whether it was dropped or renamed has no answer; retryable: no; next: give it a name or its columns. TABLESCHEMA_INDEX_INVALID — trigger: an index with no name, an unknown method, or columns its own side does not declare; retryable: no; next: correct the index. TABLESCHEMA_RENAME_INVALID — trigger: renames sent under NONE, missing under EXPLICIT, naming a column that is absent from its side or present on both, or renaming one column twice; retryable: no; next: declare each pair once against the side it belongs to. TABLESCHEMA_LIMIT_EXCEEDED — trigger: more than 1000 columns, 500 constraints or 500 indexes on a side, or more than 1000 renames; retryable: no; next: compare fewer objects per call. TABLESCHEMA_OPTION_UNSUPPORTED — trigger: a renameDetection value we do not offer; retryable: no; next: use NONE or EXPLICIT. DATABASE_CREDENTIAL_FIELD_REJECTED — trigger: a field such as password, dsn or jdbcUrl arrived anywhere in the request; retryable: no; next: remove it, because we compare declared shapes and never hold a secret.

Context footprint

Change kinds, paths and type renderings come back — never a default value, a check expression or an enum member — so a 1000-column comparison stays in the low hundreds of kilobytes. A successful call costs 2 execution credits.

When to use it

When you have the current and intended shape of a table and want to know what would break, what is safe, and what needs a look at the data first.

When you need the shape read out of a live database, the DDL written for you, or a comparison of JSON documents rather than table columns.

Scope

Note
Classifies every difference between two declared table shapes as breaking, compatible or conditional, against survival of stored data and acceptance of previously accepted writes.

Non-goals

  • Does not connect to a database or read a live catalog
  • Does not accept or parse SQL DDL — database.sql_validate_syntax reads statements
  • Does not diff JSON Schemas, which schema.diff_json_schema does against a different notion of compatibility
  • Does not generate, order or apply migration statements
  • Does not evaluate a default expression or a check expression
  • Does not guess at a rename, and takes no dialect, because it publishes the intersection of what is safe rather than one engine's cast rules

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

data-transformationvalidation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call2 credits

File handling

Accepts file_refProduces file_refMax input256 KB

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
oldSchemaobjectYesClosed previous table schema. Its properties are table, columns, and optional primaryKey and indexes.
newSchemaobjectYesClosed candidate table schema. Its properties are table, columns, and optional primaryKey and indexes.
renameDetectionstringNoRename-detection policy; omit it for disabled.
renamesarrayNoBounded optional array of explicit old/new column rename declarations; omit it when no rename should be assumed. The item shape is defined by the nested schema and the array contains from 0 through 10000 items.

Output schema

FieldTypeRequiredDescription
verdictstringYesOverall compatibility verdict.
breakingarrayYesBounded breaking schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items.
compatiblearrayYesBounded backward-compatible schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items.
conditionalarrayYesBounded conditionally compatible schema changes. The item shape is defined by the nested schema and the array contains from 0 through 100000 items.
summaryobjectYesClosed compatibility-count summary receipt. Its documented receipt properties are bounded to 128 entries — unconstrained RFC 8259 JSON items.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"database.compare_table_schema","input":{"oldSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255}}]},"newSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":false}]}}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("database.compare_table_schema", {"oldSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":true},{"name":"amount","type":{"family":"DECIMAL","precision":10,"scale":2},"nullable":true}]},"newSchema":{"table":"accounts","columns":[{"name":"email","type":{"family":"VARCHAR","length":255},"nullable":false},{"name":"amount","type":{"family":"FLOAT64"},"nullable":true},{"name":"nickname","type":{"family":"VARCHAR","length":64},"nullable":true}]}});

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.
TABLESCHEMA_INPUT_INVALID400NoThe request payload failed this skill's input validation.
TABLESCHEMA_COLUMN_NAME_DUPLICATE400NoThe request payload failed this skill's input validation.
TABLESCHEMA_TYPE_INVALID400NoThe request payload failed this skill's input validation.
TABLESCHEMA_TYPE_UNSUPPORTED400NoThe skill does not support the requested variant.
TABLESCHEMA_CONSTRAINT_INVALID400NoThe request payload failed this skill's input validation.
TABLESCHEMA_CONSTRAINT_UNMATCHABLE400NoThe request payload failed this skill's input validation.
TABLESCHEMA_INDEX_INVALID400NoThe request payload failed this skill's input validation.
TABLESCHEMA_RENAME_INVALID400NoThe request payload failed this skill's input validation.
TABLESCHEMA_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.
TABLESCHEMA_OPTION_UNSUPPORTED400NoThe skill does not support the requested variant.
DATABASE_CREDENTIAL_FIELD_REJECTED400NoThe skill does not support the requested variant.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not connect to a database or read a live catalog
  • Does not accept or parse SQL DDL — database.sql_validate_syntax reads statements
  • Does not diff JSON Schemas, which schema.diff_json_schema does against a different notion of compatibility
  • Does not generate, order or apply migration statements
  • Does not evaluate a default expression or a check expression
  • Does not guess at a rename, and takes no dialect, because it publishes the intersection of what is safe rather than one engine's cast rules
  • Reading the current shape of a live table
  • Turning the difference into the DDL that would apply it
  • Comparing JSON payload schemas rather than table columns

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "database.compare_table_schema",
  "input": {
    "oldSchema": {
      "table": "accounts",
      "columns": [
        {
          "name": "email",
          "type": {
            "family": "VARCHAR",
            "length": 255
          },
          "nullable": true
        },
        {
          "name": "amount",
          "type": {
            "family": "DECIMAL",
            "precision": 10,
            "scale": 2
          },
          "nullable": true
        }
      ]
    },
    "newSchema": {
      "table": "accounts",
      "columns": [
        {
          "name": "email",
          "type": {
            "family": "VARCHAR",
            "length": 255
          },
          "nullable": false
        },
        {
          "name": "amount",
          "type": {
            "family": "FLOAT64"
          },
          "nullable": true
        },
        {
          "name": "nickname",
          "type": {
            "family": "VARCHAR",
            "length": 64
          },
          "nullable": true
        }
      ]
    }
  }
}

Examples

A tightened column, a widened type and an added column, sorted three ways

Inputjson
{
  "oldSchema": {
    "table": "accounts",
    "columns": [
      {
        "name": "email",
        "type": {
          "family": "VARCHAR",
          "length": 255
        },
        "nullable": true
      },
      {
        "name": "amount",
        "type": {
          "family": "DECIMAL",
          "precision": 10,
          "scale": 2
        },
        "nullable": true
      }
    ]
  },
  "newSchema": {
    "table": "accounts",
    "columns": [
      {
        "name": "email",
        "type": {
          "family": "VARCHAR",
          "length": 255
        },
        "nullable": false
      },
      {
        "name": "amount",
        "type": {
          "family": "FLOAT64"
        },
        "nullable": true
      },
      {
        "name": "nickname",
        "type": {
          "family": "VARCHAR",
          "length": 64
        },
        "nullable": true
      }
    ]
  }
}
Expected outputjson
{
  "summary": {
    "verdict": "BREAKING",
    "breakingCount": 1,
    "compatibleCount": 1,
    "conditionalCount": 1,
    "oldColumnCount": 2,
    "newColumnCount": 3,
    "matchedColumnCount": 2,
    "renameDetection": "NONE"
  },
  "conditional": [
    {
      "changeKind": "COLUMN_TYPE_CHANGED",
      "path": "/columns/amount",
      "from": "DECIMAL(10,2)",
      "to": "FLOAT64",
      "reasonCode": "REPRESENTATION_NOT_NESTED",
      "noteCodes": []
    }
  ],
  "compatible": [
    {
      "changeKind": "COLUMN_ADDED_NULLABLE",
      "path": "/columns/nickname",
      "noteCodes": []
    }
  ],
  "verdict": "BREAKING",
  "breaking": [
    {
      "changeKind": "COLUMN_NULLABILITY_TIGHTENED",
      "path": "/columns/email",
      "noteCodes": []
    }
  ]
}

A declared rename beside a widening of the same column's precision

Inputjson
{
  "renames": [
    {
      "from": "total",
      "to": "amount_total"
    }
  ],
  "renameDetection": "EXPLICIT",
  "oldSchema": {
    "table": "orders",
    "columns": [
      {
        "name": "id",
        "type": {
          "family": "INT32"
        },
        "nullable": false
      },
      {
        "name": "total",
        "type": {
          "family": "DECIMAL",
          "precision": 10,
          "scale": 2
        },
        "nullable": false
      }
    ]
  },
  "newSchema": {
    "table": "orders",
    "columns": [
      {
        "name": "id",
        "type": {
          "family": "INT64"
        },
        "nullable": false
      },
      {
        "name": "amount_total",
        "type": {
          "family": "DECIMAL",
          "precision": 12,
          "scale": 2
        },
        "nullable": false
      }
    ]
  }
}
Expected outputjson
{
  "summary": {
    "verdict": "BREAKING",
    "breakingCount": 1,
    "compatibleCount": 2,
    "conditionalCount": 0,
    "oldColumnCount": 2,
    "newColumnCount": 2,
    "matchedColumnCount": 2,
    "renameDetection": "EXPLICIT"
  },
  "conditional": [],
  "compatible": [
    {
      "changeKind": "COLUMN_TYPE_CHANGED",
      "path": "/columns/amount_total",
      "from": "DECIMAL(10,2)",
      "to": "DECIMAL(12,2)",
      "noteCodes": []
    },
    {
      "changeKind": "COLUMN_TYPE_CHANGED",
      "path": "/columns/id",
      "from": "INT32",
      "to": "INT64",
      "noteCodes": []
    }
  ],
  "verdict": "BREAKING",
  "breaking": [
    {
      "changeKind": "COLUMN_RENAMED",
      "path": "/columns/total",
      "noteCodes": []
    }
  ]
}
  • Gate a release on whether a table change can break its readers or writers
  • Review a column type change before it reaches a table with rows in it
  • Show which differences are merely conditional so a reviewer looks at those

Avoid for

  • Reading the current shape of a live table
  • Turning the difference into the DDL that would apply it
  • Comparing JSON payload schemas rather than table columns

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

compatibilityvalidationschemadatabase