# Table Compare

## <img src="/files/pQllOXFc2gzqRXmaiXUs" alt="" data-size="line"> Table Compare

### Description <a href="#description" id="description"></a>

The Table Compare transform compares the data from two tables (provided they have the same lay-out), finds differences between the data in the two tables and logs it.

| Hop Engine | <sup>✓</sup> |
| ---------- | ------------ |
| Spark      | ?            |
| Flink      | ?            |
| Dataflow   | ?            |

### Options

#### Reference/Comparison data tab

| Option                                        | Description                                                                                                                                     |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Reference connection / Compare connection     | Database connections from which the reference/compare table data will come.                                                                     |
| Reference schema field / Compare schema field | contain the schema names for the reference/compare table.                                                                                       |
| Reference table field / Compare table field   | contain the actual table names. This means that you could compare two tables with a different name, as long as they have the same column names. |

#### Other fields tab

| Option               | Description                                                                                                                                                                                                                  |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Key fields field     | should contain a comma separated list of they fields that make up the 'primary' key of the table(s) you are comparing. The primary key is needed because without this information the two tables cannot be correctly joined. |
| Exclude fields field | contains a comma separated list of columns that you want to exclude from the comparison. E.g. because they exist in the first table, but not in the second.                                                                  |

#### Additional fields tab

| Option                                             | Description                                                                                                                               |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Number of errors field                             | allows you to specify the name of the output column that will contain the total number of errors found for the comparison of your tables. |
| Number of reference/compare table records field    | allows you to specify the name of the field that will contain the actual number of records found in each table.                           |
| Number of left/inner/right join errors field       | allows you to specify the name of the field(s) that will contain the number of errors found for each join type.                           |
| Error handling key description input field         | allows you specify the name of the output field for the 'where clause" of the record that gave an error.                                  |
| Error handling reference/compare value input field | allows you to specify the output field names for the actual values that differ.                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/tablecompare.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
