/data-engineering:sql-server-table-reconciliationfrom data-engineering
Compares SQL Server tables across source and target instances for migration validation, ETL verification, schema drift, missing/extra rows, and column mismatches using mssql-python with Apache Arrow.
Ships in data-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Compare identical SQL Server tables across two instances with Python, mssql-python, Apache Arrow, and primary-key based row matching, then produce a reconciliation report for schema drift, missing rows, extra rows, and mismatched values.
Collect these before execution:
| Parameter | Required | Default | Description |
|---|---|---|---|
| Source server | Yes | - | Source SQL Server, for example prod-server.database.windows.net. |
| Source database | Yes | - | Source database name. |
| Target server | Yes | - | Target SQL Server, for example staging-server.database.windows.net. |
| Target database | Yes | - | Target database name. |
| Tables | Yes | - | Comma-separated schema.table names or schema.*, for example dbo.Orders,dbo.Items or dbo.*. |
| Auth mode | Yes | - | sql for user/password or username/password, or entra for Azure AD/token. |
| Primary key | Auto-detect | metadata | Column or columns forming row identity. Ask if auto-detect fails. |
| Columns to compare | No | all non-PK | Comma-separated subset. |
| Chunk size | No | 100000 | Rows per batch for large tables. |
| Output format | No | console | console, csv, parquet, or json. |
Install runtime packages only when the environment lacks them:
pip install mssql-python pyarrow pandas
The bundled script lives at scripts/reconcile.py and must be run from the skill package or with the correct relative path.
cursor.arrow().python scripts/reconcile.py --source-server <source_server> --source-database <source_database> --target-server <target_server> --target-database <target_database> --tables "<table_spec>" --auth <sql|entra> --chunk-size <chunk_size> --output <console|csv|json>
Optional arguments:
| Argument | Description |
|---|---|
--primary-key | Comma-separated PK columns; omit to auto-detect. |
--columns | Comma-separated columns to compare; omit for all non-PK columns. |
Example with SQL auth:
python scripts/reconcile.py --source-server prod-server.database.windows.net --source-database ProdDB --target-server staging-server.database.windows.net --target-database StagingDB --tables "dbo.Orders" --auth sql --output console
Example wildcard with Entra auth and CSV:
python scripts/reconcile.py --source-server prod-server.database.windows.net --source-database ProdDB --target-server staging-server.database.windows.net --target-database StagingDB --tables "dbo.*" --auth entra --output csv
| Rule | Implementation |
|---|---|
| Type normalization | Cast decimals to the same precision, trim strings, and normalize datetimes to UTC. |
| NULL handling | Treat NULL == NULL as a match. |
| Row order | Ignore row order; join by primary key. |
| Large tables | Use chunk extraction with OFFSET/FETCH or ROW_NUMBER() partitioning. |
| Credentials | Never hardcode credentials; read MSSQL_USER and MSSQL_PASSWORD from os.environ or prompt with getpass. |
| Query safety | Use parameterized queries with ? placeholders for metadata lookups; never f-string interpolate user input into SQL. |
For tables above 1M rows, pre-check row hashes and fetch full rows only for mismatches:
SELECT {pk_cols},
HASHBYTES('SHA2_256', CONCAT_WS('|', col1, col2, ...)) AS row_hash
FROM {table}
| Scenario | Strategy |
|---|---|
< 100K rows | Single Arrow fetch and in-memory pandas compare. |
100K–1M rows | Chunked extraction using 100000 row batches and streaming comparison. |
> 1M rows | Hash pre-check, then fetch only mismatched rows. |
Wide tables, 100+ columns | Compare PK plus hash first, then drill into mismatched columns. |
| Network-constrained | Prefer Arrow columnar transfer, commonly 10-50x smaller than row-by-row extraction. |
mssql-python, not pyodbc or pymssql; the workflow depends on Arrow support.encrypt=True throw errors.scripts/reconcile.py: standalone reconciliation script that accepts the source, target, table, auth, chunking, and output arguments described above.For multi-table runs, use compact per-table rows and expand detail only for tables with FAIL or DIFFERENCES FOUND status. Include examples such as dbo.JOBS when showing multiple tables.
Reconciling dbo.EMPLOYEES...
Reconciling dbo.DEPARTMENTS...
Reconciling dbo.JOBS...
=== Summary: 2 passed, 1 failed, 0 skipped / 3 tables ===
MUST requirements in this skill are hard constraints, not preferences.
## SQL Server reconciliation
**Status:** identical | differences found | blocked
**Source:** `<source server>/<source database>`
**Target:** `<target server>/<target database>`
| Table | Source rows | Target rows | Missing | Extra | Mismatches | Result |
| --- | ---: | ---: | ---: | ---: | ---: | --- |
| `dbo.EMPLOYEES` | 107 | 107 | 0 | 0 | 0 | IDENTICAL |
| `dbo.DEPARTMENTS` | 27 | 27 | 0 | 0 | 3 | DIFFERENCES FOUND |
### Detail for failed tables
- `<schema.table>`: <schema drift, sample missing PKs, sample mismatched columns>
### Validation
- Primary key detection: <pass|fail>
- Extraction mode: <single Arrow|chunked|hash pre-check>
- Credentials handling: <environment|getpass|blocked>
mssql-python, Apache Arrow via cursor.arrow(), and pandas comparison are used.NULL comparison rules are applied.HASHBYTES('SHA2_256', CONCAT_WS(...)) optimization.MSSQL_USER, MSSQL_PASSWORD, or getpass and are never logged.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/bigquery-pipeline-auditAudit Python and BigQuery pipeline scripts for cost exposure, dry-run safety, bounded backfills, query pruning, idempotent writes, and observability. Use this skill when reviewing client.query, load_table_from_*, extract_table, copy_table, DDL/DML query jobs, external API calls, LLM calls, or storage writes before production use./datanalysis-credit-riskRun and explain a credit risk data cleaning and variable screening pipeline for pre-loan modeling, including missing value analysis, abnormal period filtering, high-missing removal, low-IV filtering, high-PSI filtering, Null Importance denoising, high-correlation removal, organization-level analysis, OOS separation, and Excel report generation. Use this skill when working on credit risk data cleaning, variable screening, and pre-loan modeling preprocessing./pinecone-ragBuild production RAG pipelines and persistent agent memory with Pinecone as the vector database backend. Use this skill when indexing documents for semantic search, building retrieval-augmented generation, storing agent memory across sessions, implementing hybrid search, designing namespace isolation for multi-tenant agents, creating embedding pipelines, or scaling a searchable knowledge base beyond local storage./snowflake-semanticviewCreate, alter, validate, and troubleshoot Snowflake semantic views with Snowflake CLI. Use this skill when asked to build semantic layer DDL, validate CREATE SEMANTIC VIEW or ALTER SEMANTIC VIEW statements, add synonyms and comments, query SEMANTIC_VIEW output, or set up snow connections./ssma-consoleGenerate XML configuration and execute Microsoft SQL Server Migration Assistant for Oracle console operations without wrapper scripts. Use when asked to create an SSMA project, assess Oracle to SQL Server migration, convert schema, synchronize target schema, migrate data, or troubleshoot SSMAforOracleConsole.exe XML scripts.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin data-engineeringOther plugins' skills for the same job