You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Introduce review commands for diff analysis and reporting
- Added `review_cmds.py` to handle various review commands including:
- `review_diff_cmd`: Review standard diff results.
- `review_stats_cmd`: Review column-level statistics for a diff.
- `review_missing_cmd`: Review rows that exist only on one side.
- `review_columns_cmd`: List available columns in the diff data.
- `review_export_cmd`: Export diff results to an XLSX report.
- `review_meta_cmd`: Emit JSON metadata for AI/LLM analysis.
- Created `run.py` to manage different run commands for comparing tables, files, and SQL queries, including:
- `run_file_cmd`: Compare two CSV/XLSX files.
- `run_query_cmd`: Compare two SQL query results.
- `run_unified_cmd`: A concise command to run comparisons based on mode.
- `run_dataset_cmd`: Compare datasets defined in YAML configuration.
- Implemented `run_auto.py` for automatic detection of input types (tables, files, SQL) and comparison execution.
- Added `run_stats.py` for comparing table statistics without row-by-row comparison.
- Developed `run_table.py` for detailed comparison of two tables or CSV/XLSX files.
- Updated tests to reflect changes in command structure from `inspect` to `review`, ensuring all functionalities are covered.
- Refactored CLI commands to improve usability and maintainability.
Copy file name to clipboardExpand all lines: README.md
+29-30Lines changed: 29 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ When you modify logic, filters, or inputs, it lets you compare the previous and
5
5
6
6
You can compare datasets in two complementary ways:
7
7
8
-
1) Row-by-row comparison (with an ID): detect missing rows on either side, identify the columns with the most changes, and inspect before/after values for any record.
8
+
1) Row-by-row comparison (with an ID): detect missing rows on either side, identify the columns with the most changes, and review before/after values for any record.
9
9
2) Statistical comparison: compare column-level statistics such as null counts, distinct counts, and other aggregates to quickly understand overall impact.
*`--file-path` is optional; if omitted, SQLCompare generates a readable timestamped filename.
92
-
*`--save summary|complete` is for the standard diff view and should not be combined with `--stats`, `--missing-current`, `--missing-previous`, or `--list-columns`.
90
+
*`--output` is optional; if omitted, SQLCompare generates a readable timestamped filename.
91
+
*`review export` is for the standard diff view and should not be combined with `review stats`, `review missing`, or `review columns`.
93
92
94
93
---
95
94
96
-
## diff-queries (AI-friendly metadata)
95
+
## review meta (AI-friendly metadata)
97
96
98
-
Use `diff-queries` to get a JSON payload describing the queryable tables and ready-to-run SQL templates for a given `diff_id`. This is especially useful for AI agents that need structured context before running analysis queries.
97
+
Use `review meta` to get a JSON payload describing the queryable tables and ready-to-run SQL templates for a given `diff_id`. This is especially useful for AI agents that need structured context before running analysis queries.
99
98
100
99
```bash
101
-
sqlcompare diff-queries<diff_id>
100
+
sqlcompare review meta<diff_id>
102
101
```
103
102
104
103
Output (JSON):
@@ -137,7 +136,7 @@ SQLCompare does two things:
137
136
Best for production validation and regression checks across supported connectors.
138
137
139
138
```bash
140
-
sqlcompare run analytics.users analytics.users_new user_id,tenant_id
139
+
sqlcompare run table analytics.users analytics.users_new user_id,tenant_id
141
140
```
142
141
143
142
Why it’s useful:
@@ -154,17 +153,17 @@ Use this when tables aren’t materialized yet or you want a filtered slice.
154
153
Inline SQL:
155
154
156
155
```bash
157
-
sqlcompare run \
158
-
"SELECT * FROM analytics.orders WHERE order_date < '2024-01-01'" \
159
-
"SELECT * FROM analytics.orders WHERE order_date >= '2024-01-01'" \
160
-
order_id \
156
+
sqlcompare run query \
157
+
--previous "SELECT * FROM analytics.orders WHERE order_date < '2024-01-01'" \
158
+
--current "SELECT * FROM analytics.orders WHERE order_date >= '2024-01-01'" \
159
+
--index order_id \
161
160
-c snowflake_prod
162
161
```
163
162
164
163
SQL files:
165
164
166
165
```bash
167
-
sqlcompare run queries/previous.sql queries/current.sql order_id -c snowflake_prod
sqlcompare run dataset tests/datasets/row_compare/dataset.yaml
9
9
```
10
10
11
11
## Output
@@ -45,6 +45,6 @@ Rows only in previous dataset: 1
45
45
| 1 | name | alpha | alfa |
46
46
| 1 | amount | 10 | 11 |
47
47
+----+--------+--------+---------+
48
-
🔎 To review the diff, run: sqlcompare inspect compare_sqlcompare_dataset_dataset_998aa249_previous_sqlcompare_dataset_dataset_998aa249_new_20260104_025829_b28946b5
49
-
💡 Tips: --stats for per-column counts, --missing-current/--missing-previous for row-only, --column <name> to filter, --list-columns to inspect available fields.
48
+
🔎 To review the diff, run: sqlcompare review compare_sqlcompare_dataset_dataset_998aa249_previous_sqlcompare_dataset_dataset_998aa249_new_20260104_025829_b28946b5
49
+
💡 Tips: sqlcompare review stats <diff_id> for per-column counts, sqlcompare review missing <diff_id> --side current|previous for row-only, sqlcompare review diff <diff_id> --column <name> to filter, sqlcompare review columns <diff_id> to inspect available fields.
Copy file name to clipboardExpand all lines: skills/sqlcompare-core-run/SKILL.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: sqlcompare-core-run
3
-
description: Run SQLCompare core comparisons across tables, SQL queries, and files to produce a diff_id. Use when the user wants to compare two datasets, choose index keys, set connectors, or run dataset configs via sqlcompare run/table/dataset/stats/query.
3
+
description: Run SQLCompare core comparisons across tables, SQL queries, and files to produce a diff_id. Use when the user wants to compare two datasets, choose index keys, set connectors, or run dataset configs via sqlcompare run subcommands or sqlcompare query.
4
4
---
5
5
6
6
# SQLCompare Core Run
@@ -17,23 +17,23 @@ Run the primary SQLCompare commands that create comparison artifacts and return
17
17
Use these patterns to pick the right entry point.
18
18
19
19
1. Compare two tables or views.
20
-
`sqlcompare run analytics.fact_sales analytics.fact_sales_new id`
20
+
`sqlcompare run table analytics.fact_sales analytics.fact_sales_new id`
21
21
2. Compare two SQL queries (inline or .sql files).
22
-
`sqlcompare run "SELECT ..." "SELECT ..." id -c snowflake_prod`
23
-
`sqlcompare run queries/previous.sql queries/current.sql id -c snowflake_prod`
22
+
`sqlcompare run query --previous "SELECT ..." --current "SELECT ..." --index id -c snowflake_prod`
23
+
`sqlcompare run query --previous queries/previous.sql --current queries/current.sql --index id -c snowflake_prod`
24
24
3. Compare local files (CSV/XLSX) with DuckDB.
25
-
`sqlcompare run path/to/previous.csv path/to/current.xlsx id`
25
+
`sqlcompare run file path/to/previous.csv path/to/current.xlsx id`
26
26
4. Use a dataset config for repeatable runs.
27
-
`sqlcompare dataset path/to/dataset.yaml`
27
+
`sqlcompare run dataset path/to/dataset.yaml`
28
28
5. Run a fast statistical comparison (no diff_id needed for row-level drilldown).
description: Analyze SQLCompare outputs after a core run. Use when the user has a diff_id and needs to inspect stats, missing rows, column-level diffs, exports, or AI-friendly diff-queries.
3
+
description: Analyze SQLCompare outputs after a core run. Use when the user has a diff_id and needs to review stats, missing rows, column-level diffs, exports, or AI-friendly meta output.
4
4
---
5
5
6
6
# SQLCompare Output Analysis
7
7
8
8
## Overview
9
-
Interpret and drill into a SQLCompare diff_id using inspect, list-diffs, and diff-queries. Produce summaries, targeted column reviews, and exportable reports.
9
+
Interpret and drill into a SQLCompare diff_id using review, history, and review meta. Produce summaries, targeted column reviews, and exportable reports.
10
10
11
11
## Start From A diff_id
12
12
1. If you already have a diff_id, proceed to inspection commands.
13
13
2. If you do not, list recent diffs and pick the correct one.
0 commit comments