# SQL result comparator

- Human page: https://happytails.ai/en/data-tools/sql-result-comparator/
- Markdown: https://happytails.ai/en/data-tools/sql-result-comparator.md
- Structured JSON: https://happytails.ai/agents/en/data-tools/sql-result-comparator/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `sql-result-comparator` |
| Category | data-tools |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Automatic updates after valid input or file selection. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Runs locally on your device. CSV requires unique nonempty headers. Up to 1,000,000 characters, 10,000 data records and 100,000 cells across inputs, with 100 columns. Quoted multiline cells are supported. Each JSON settings field is limited to 100,000 characters. Output files are bounded to 4,000,000 characters. Diagnostic reports contain at most 500 findings and disclose the omitted count. Compare exported query results without connecting to a database. Numeric values match when |a-b| <= absolute + relative × max(|a|,|b|). Added and removed columns are reported separately. CSV does not preserve the distinction between SQL NULL and an empty string. Protect spreadsheet cells prefixes formula-like values, including negative numbers, with an apostrophe. Choose Preserve original cells only for a trusted import workflow.

### Inputs and settings

Text input: First query result as CSV.

Example or placeholder shown in the interface (not a validated fixture):

```text
id,amount
A,10
B,3
```

Paste exported query results as CSV, including the header row. This tool compares the results; it does not execute SQL. Results update as you type. Up to 1,000,000 characters.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `separator` | Input CSV separator | select | "," | Allowed: ,, ;, 	 |
| `comparison` | Comparison CSV | textarea | "id,amount\nA,10.00\nB,3.50\n" |  |
| `keys` | Business key columns (JSON) | textarea | "[\"id\"]" |  |
| `numeric` | Numeric comparison columns (JSON) | textarea | "[\"amount\"]" |  |
| `absolute` | Absolute tolerance | text | "0" |  |
| `relative` | Relative tolerance (0 to 1) | text | "0" |  |
| `outputSafety` | CSV output cells | select | "Protect spreadsheet cells" | Allowed: Protect spreadsheet cells, Preserve original cells |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

A numeric pair matches when abs(a-b) is at most absolute plus relative times the larger magnitude. Other fields compare exact strings. CSV cannot distinguish a SQL NULL from an exported empty string. No database connection is made. Up to 1,000,000 characters, 10,000 data records, 100 columns and 100,000 cells across the sources. Files for multi-source tools are limited to 4,000,000 bytes total. Reports retain at most 500 diagnostic findings and state any omitted count. CSV and JSON outputs are limited to 4,000,000 characters. Output is budgeted incrementally before retaining each row; expanded decimal output counts toward the same 4,000,000-character limit even when input uses short exponent notation.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "sql-result-comparator",
  "category": "data-tools",
  "built": true,
  "requirements": "A numeric pair matches when abs(a-b) is at most absolute plus relative times the larger magnitude. Other fields compare exact strings. CSV cannot distinguish a SQL NULL from an exported empty string. No database connection is made. Up to 1,000,000 characters, 10,000 data records, 100 columns and 100,000 cells across the sources. Files for multi-source tools are limited to 4,000,000 bytes total. Reports retain at most 500 diagnostic findings and state any omitted count. CSV and JSON outputs are limited to 4,000,000 characters. Output is budgeted incrementally before retaining each row; expanded decimal output counts toward the same 4,000,000-character limit even when input uses short exponent notation.",
  "implementation": {
    "fields": [
      {
        "key": "separator",
        "label": "Input CSV separator",
        "value": ",",
        "type": "select",
        "values": [
          ",",
          ";",
          "\t"
        ]
      },
      {
        "key": "comparison",
        "label": "Comparison CSV",
        "value": "id,amount\nA,10.00\nB,3.50\n",
        "type": "textarea",
        "help": "Paste the second table, including its header row. Both tables use the selected separator."
      },
      {
        "key": "keys",
        "label": "Business key columns (JSON)",
        "value": "[\"id\"]",
        "type": "textarea",
        "help": "Exact nonempty unique row keys, supporting multiple columns."
      },
      {
        "key": "numeric",
        "label": "Numeric comparison columns (JSON)",
        "value": "[\"amount\"]",
        "type": "textarea",
        "help": "Only these columns use numeric tolerance; all other values compare exact strings."
      },
      {
        "key": "absolute",
        "label": "Absolute tolerance",
        "value": "0",
        "type": "text"
      },
      {
        "key": "relative",
        "label": "Relative tolerance (0 to 1)",
        "value": "0",
        "type": "text"
      },
      {
        "key": "outputSafety",
        "label": "CSV output cells",
        "value": "Protect spreadsheet cells",
        "type": "select",
        "values": [
          "Protect spreadsheet cells",
          "Preserve original cells"
        ]
      }
    ],
    "live": true,
    "presentation": "metrics",
    "note": "Runs locally on your device. CSV requires unique nonempty headers. Up to 1,000,000 characters, 10,000 data records and 100,000 cells across inputs, with 100 columns. Quoted multiline cells are supported. Each JSON settings field is limited to 100,000 characters. Output files are bounded to 4,000,000 characters. Diagnostic reports contain at most 500 findings and disclose the omitted count. Compare exported query results without connecting to a database. Numeric values match when |a-b| <= absolute + relative × max(|a|,|b|). Added and removed columns are reported separately. CSV does not preserve the distinction between SQL NULL and an empty string. Protect spreadsheet cells prefixes formula-like values, including negative numbers, with an apostrophe. Choose Preserve original cells only for a trusted import workflow.",
    "experience": {
      "automatic": true,
      "single": false,
      "inputMaxLength": 1000000,
      "inputMode": "text",
      "label": "First query result as CSV",
      "placeholder": "id,amount\nA,10\nB,3",
      "help": "Paste exported query results as CSV, including the header row. This tool compares the results; it does not execute SQL. Results update as you type. Up to 1,000,000 characters.",
      "action": null
    },
    "mode": "automatic",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Compare exported query results by key, with exact text checks and configurable numeric tolerances.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use SQL result comparator

1. Export each query result as a CSV and paste both tables.
2. Select unique row keys, numeric columns and absolute or relative tolerance.
3. Review changed values, missing rows and schema changes in the download.

## Useful next steps

- [CSV reconciliation report](https://happytails.ai/en/data-tools/csv-reconciliation-report/) ([Markdown](https://happytails.ai/en/data-tools/csv-reconciliation-report.md))

- [Dataset schema drift detector](https://happytails.ai/en/data-tools/dataset-schema-drift-detector/) ([Markdown](https://happytails.ai/en/data-tools/dataset-schema-drift-detector.md))

## Prepare the source

Export each query result as a CSV and paste both tables.

### Choose the matching rules

Select unique row keys, numeric columns and absolute or relative tolerance.

### Review and keep the result

Review changed values, missing rows and schema changes in the download. A numeric pair matches when abs(a-b) is at most absolute plus relative times the larger magnitude. Other fields compare exact strings. CSV cannot distinguish a SQL NULL from an exported empty string. No database connection is made.
